PHPackages                             fewfar/laravel-frontend - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. fewfar/laravel-frontend

ActiveLibrary[Framework](/categories/framework)

fewfar/laravel-frontend
=======================

Frontend Build Framework for Laravel Projects

1.0.1(5y ago)046MITPHPCI failing

Since Jun 28Pushed 5y ago1 watchersCompare

[ Source](https://github.com/few-far/laravel-frontend)[ Packagist](https://packagist.org/packages/fewfar/laravel-frontend)[ RSS](/packages/fewfar-laravel-frontend/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (4)Versions (3)Used By (0)

[![Laravel Frontend](logo.svg)](logo.svg)

[![Build Status](https://camo.githubusercontent.com/b94b336ce99404a6553ab670ca85c8d7086260ef079a9508518fb26e7a78d941/68747470733a2f2f7472617669732d63692e6f72672f6665772d6661722f6c61726176656c2d66726f6e74656e642e737667)](https://travis-ci.org/few-far/laravel-frontend)[![Total Downloads](https://camo.githubusercontent.com/98470bc145108f51770317d2b536382d6bd91ebfdb9ef63e734df8a06308e8c3/68747470733a2f2f706f7365722e707567782e6f72672f6665772d6661722f6c61726176656c2d66726f6e74656e642f642f746f74616c2e737667)](https://packagist.org/packages/few-far/laravel-frontend)[![Latest Stable Version](https://camo.githubusercontent.com/ab5a9a2ffad0fc86642b96781fe448ad3da1e66f614af3a9d08450d2c9cacfc3/68747470733a2f2f706f7365722e707567782e6f72672f6665772d6661722f6c61726176656c2d66726f6e74656e642f762f737461626c652e737667)](https://packagist.org/packages/few-far/laravel-frontend)[![License](https://camo.githubusercontent.com/20c0ec71e8c46c5a637c073bad634ae3c1b8c4b565f5821bf48363759bbcfa61/68747470733a2f2f706f7365722e707567782e6f72672f6665772d6661722f6c61726176656c2d66726f6e74656e642f6c6963656e73652e737667)](https://packagist.org/packages/few-far/laravel-frontend)

Laravel package to provide frontend template routes for non-production environments.

Installation
------------

[](#installation)

```
composer require fewfar/laravel-frontend
```

The package's service provider will be autoloaded on startup.

Next publish the templates and config file:

```
php artisan vendor:publish --provider="FewFar\LaravelFrontend\ServiceProvider"
```

The files published this way are examples of structure and are not enforced by the package. Edit `config/vendor/fewfar/frontend.php` to change the paths of these files.

Basic Usage
-----------

[](#basic-usage)

Add the following key to your `.env` file to enable the frontend routes (typically, local and staging):

```
FRONTEND_ENABLED=true
```

If this key is already in use for your project, you can change this in the `config/vendor/fewfar/frontend.php` file.

Now you can visit `/templates/` and see the templates.

Page Defaults
-------------

[](#page-defaults)

Often within an app, it is useful to have view composers that load fallback variables from a configuration or the database when not provided by the controller explicitly. An example of this could be the page title in the HTML `` for example. Depending on the setup you might not have a database defined when building the frontend templates, or you might not even want the database involved. In this case you still want your layout templates to recieve this variables, but it would be nice to hard code them for all the frontend templates.

To do this you can subclass the `PageDefaultsViewComposer` and add register it within a service provider:

### Subclass the View Composer implementing your own values

[](#subclass-the-view-composer-implementing-your-own-values)

```
