PHPackages                             awjudd/layoutview - 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. [Templating &amp; Views](/categories/templating)
4. /
5. awjudd/layoutview

ActiveLibrary[Templating &amp; Views](/categories/templating)

awjudd/layoutview
=================

A quick and easy way to handle different layouts in Laravel 5.

1.3.0(10y ago)46.1k3[1 issues](https://github.com/awjudd/l4-layoutview/issues)[1 PRs](https://github.com/awjudd/l4-layoutview/pulls)MITPHPPHP &gt;=5.4.0

Since Jan 11Pushed 9y ago3 watchersCompare

[ Source](https://github.com/awjudd/l4-layoutview)[ Packagist](https://packagist.org/packages/awjudd/layoutview)[ RSS](/packages/awjudd-layoutview/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (7)Dependencies (1)Versions (9)Used By (0)

Laravel 5 - Layout View
=======================

[](#laravel-5---layout-view)

[![Build Status](https://camo.githubusercontent.com/63d3f526cc8df37754d66a31fdfe67124675f33a1255b85a806e76a6253084d7/68747470733a2f2f6170692e7472617669732d63692e6f72672f61776a7564642f6c342d6c61796f7574766965772e706e67)](https://travis-ci.org/awjudd/l4-layoutview)[![ProjectStatus](https://camo.githubusercontent.com/e089554b60cc27bbf8d276a78decfbbbdab4739634d06719e9c771d9a72e24a2/687474703a2f2f7374696c6c6d61696e7461696e65642e636f6d2f61776a7564642f6c342d6c61796f7574766965772e706e67)](http://stillmaintained.com/awjudd/l4-layoutview)

A quick and easy way to handle different layouts in **Laravel 5**

Features
--------

[](#features)

- Adds the ability to have your views automatically chosen based on your selected layout
- Supports a primary layout and a fallback layout

Quick Start
-----------

[](#quick-start)

In the `require` key of `composer.json` file add the following

```
"awjudd/layoutview": "1.2.*"

```

Run the Composer update command

```
$ composer update

```

In your `config/app.php` add `'Awjudd\Layoutview\LayoutviewServiceProvider'` to the end of the `$providers` array

```
'providers' => array(

    'Illuminate\Foundation\Providers\ArtisanServiceProvider',
    'Illuminate\Auth\AuthServiceProvider',
    ...
    'Awjudd\Layoutview\LayoutviewServiceProvider',

),

'aliases' => array(

    'App'             => 'Illuminate\Support\Facades\App',
    'Artisan'         => 'Illuminate\Support\Facades\Artisan',
    ...
    'View'            => 'Awjudd\Layoutview\Facades\LayoutViewFacade',
),
```

### Setup

[](#setup)

Setup for Layout View is simple. All you need to do is change the mapping in the aliases array for the "View" to point to the new type.

Once done, the next step for you to do is to configure the namespaces that you want included as well as the priority of the views that are being rendered. To publish the configuration you can do the following:

```
$ php artisan config:publish awjudd/layoutview

```

There are two ways to configure what the base and fallback layouts are. The two ways are as follows:

- In the configuration file, you can fill in the following values in the configuration file:

```
'layout' => array (

    /**
     * The layout that will be used to fall back on if the selected doesn't exist.
     *
     * @var string
     */
    'fallback' => NULL,

    /**
     * The layout that will be the first choice to be used.
     *
     * @var string
     */
    'selected' => NULL,
),
```

- In your base controller call the following functions:

```
View::setSelectedLayout('base layout name');
View::setFallbackLayout('fallback layout name');
```

### Configuration

[](#configuration)

Within the configuration file there is a single key. This key is `'namespaces'`. Fill this array with any namesapces that you would like the application to look through the folders of in order to find the best-fitting view.

**Please Note** The order that the elements are added in this array dictate the order in which they are scanned through for display purposes. Because of this, you will want your most specific namespaces to be listed first.

```
'namespaces' => array (
    /*
     * Should always keep a blank one here to search in no namespaces.
     */
    '',
),
```

Folder Structure
----------------

[](#folder-structure)

In order for this to work, this package requires the following folder structure (in short, your layout name is the top level).

```
./views
    ./base
        ./home
            ./index.blade.php
    ./fallback
        ./home
            ./index.blade.php
            ./test.blade.php
        ./layout
            ./html.blade.php

```

In this example, "base" and "fallback" are your two possible layouts. If you have "base" as your selected layout, and "fallback" as your fallback view (meaning if one doesn't exist in your main, it will look there next). If you do the following:

```
View::make('home.index');
```

It will render the view in 'base/home/index'. However, if you do one that doesn't exist in the base folder, then it will automatically pick up the one from the fallback. Example:

```
View::make('home.test');
```

Will render 'fallback/home/test'.

License
-------

[](#license)

Layout View is free software distributed under the terms of the MIT license

Release Notes:
--------------

[](#release-notes)

1.1.0:

- Laravel 4.2 support

1.1.1:

- Removing the necessity to add the "::" into the namespaces
- Making it so that if you don't specify a base/fallback layout it will ignore the folder

Additional Information
----------------------

[](#additional-information)

Any issues, please [report here](https://github.com/awjudd/l4-layoutview/issues)

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 97.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~118 days

Recently: every ~138 days

Total

7

Last Release

3836d ago

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

1.2.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/6c1a37465afdee14b2740a387deaae40ac376e38015db7af98f90b7fd97fed22?d=identicon)[awjudd](/maintainers/awjudd)

---

Top Contributors

[![awjudd](https://avatars.githubusercontent.com/u/1910996?v=4)](https://github.com/awjudd "awjudd (40 commits)")[![d-lamers](https://avatars.githubusercontent.com/u/3164508?v=4)](https://github.com/d-lamers "d-lamers (1 commits)")

### Embed Badge

![Health badge](/badges/awjudd-layoutview/health.svg)

```
[![Health](https://phpackages.com/badges/awjudd-layoutview/health.svg)](https://phpackages.com/packages/awjudd-layoutview)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[moonshine/moonshine

Laravel administration panel

1.3k239.9k75](/packages/moonshine-moonshine)[illuminate/view

The Illuminate View package.

13046.3M2.1k](/packages/illuminate-view)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

721160.4k12](/packages/tallstackui-tallstackui)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45344.0k1](/packages/pressbooks-pressbooks)[hasinhayder/tyro-dashboard

Tyro Dashboard - Beautiful admin dashboard for managing Tyro roles, privileges, users, and settings

5452.7k](/packages/hasinhayder-tyro-dashboard)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
