PHPackages                             erag/laravel-setup-layout - 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. erag/laravel-setup-layout

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

erag/laravel-setup-layout
=========================

A package for setting up layout in Laravel applications.

v1.2(1y ago)31.1kMITPHPPHP &gt;=8.0.0

Since Mar 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/eramitgupta/laravel-setup-layout)[ Packagist](https://packagist.org/packages/erag/laravel-setup-layout)[ RSS](/packages/erag-laravel-setup-layout/feed)WikiDiscussions main Synced 3mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

Advanced Layout Setup for Laravel Applications 🔥
------------------------------------------------

[](#advanced-layout-setup-for-laravel-applications-)

[![Screenshot 2024-10-04 at 10 34 23 PM](https://private-user-images.githubusercontent.com/72160684/373739481-b05fe465-6349-4705-9cf5-4f7086182f2d.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODIxNDQ3NDEsIm5iZiI6MTc4MjE0NDQ0MSwicGF0aCI6Ii83MjE2MDY4NC8zNzM3Mzk0ODEtYjA1ZmU0NjUtNjM0OS00NzA1LTljZjUtNGY3MDg2MTgyZjJkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNjIyVDE2MDcyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ2YjIzMThkMzkxZTU4NDNhMmJhNzYwZjQwNTdhZjU2NmY5YjQyMzRjZGQ0OWFkMTMwYzc1NjExNzk3MmVmOGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.7rGRBfPtlDst1sS9--rKnjU_dMfx8HKAqg5PNicnW9U)](https://private-user-images.githubusercontent.com/72160684/373739481-b05fe465-6349-4705-9cf5-4f7086182f2d.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3ODIxNDQ3NDEsIm5iZiI6MTc4MjE0NDQ0MSwicGF0aCI6Ii83MjE2MDY4NC8zNzM3Mzk0ODEtYjA1ZmU0NjUtNjM0OS00NzA1LTljZjUtNGY3MDg2MTgyZjJkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNjIyVDE2MDcyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ2YjIzMThkMzkxZTU4NDNhMmJhNzYwZjQwNTdhZjU2NmY5YjQyMzRjZGQ0OWFkMTMwYzc1NjExNzk3MmVmOGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.7rGRBfPtlDst1sS9--rKnjU_dMfx8HKAqg5PNicnW9U)[![Packagist License](https://camo.githubusercontent.com/e60623f508586f049d48cfb8396ee411b0c9bc3be174381a1893c37462a3c1e5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e63652d4d49542d626c7565)](https://github.com/eramitgupta/laravel-setup-layout/blob/main/LICENSE)[![Latest Stable Version](https://camo.githubusercontent.com/b9f3d5d876afde867c8e6c083f5ad99dcd9794b6cb6f7fdc117e16d06ddc9568/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f657261672f6c61726176656c2d73657475702d6c61796f75743f6c6162656c3d537461626c65)](https://packagist.org/packages/erag/laravel-setup-layout)[![Total Downloads](https://camo.githubusercontent.com/b252e81b2f7341d0db0cd0450a3e9ee45fca7f350ac2fc9c9e0f6630bcfc03b7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f657261672f6c61726176656c2d73657475702d6c61796f75742e7376673f6c6162656c3d446f776e6c6f616473)](https://packagist.org/packages/erag/laravel-setup-layout)

A versatile, easy-to-use package to streamline layout creation in Laravel. Features
--------

[](#features)

- Simplifies layout management.
- Customizable configurations to fit your app's needs.
- Improves structure and organization in Laravel projects.

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

[](#installation)

Install the package via Composer:

```
composer require erag/laravel-setup-layout
```

### Step 1: Register Service Provider

[](#step-1-register-service-provider)

#### Laravel 11.x

[](#laravel-11x)

Ensure the service provider is registered in `/bootstrap/providers.php`:

```
return [
    // ...
    LaravelSetupLayoutServiceProvider::class
];
```

#### Laravel 10.x

[](#laravel-10x)

Add the service provider in `config/app.php`:

```
'providers' => [
    // ...
    LaravelSetupLayout\LaravelSetupLayoutServiceProvider::class,
];
```

### Step 2: Publish Configuration

[](#step-2-publish-configuration)

Run this command to publish the configuration file:

```
php artisan vendor:publish --tag=LaravelSetupLayout --force
```

### Step 4: assets `config/layout-assets.php`

[](#step-4-assets-configlayout-assetsphp)

```
 [
          'home' => [
               // CSS files for the home page
               'css' => [
                    'assets/css/demo.css',
               ],
               // JavaScript files for the home page
               'js'  => [
                    'assets/js/demo.js',
               ],
          ],
          // You can add more as per your requirement
     ],

     #THEME_ASSETS   Define global assets used across all pages
     'THEME_ASSETS' => [
          'global'  => [
               // Global CSS files, such as Bootstrap
               'css' => [
                    'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css',
                    // You can add more global CSS files here
               ],
               // Global JavaScript files, such as Bootstrap JS
               'js'  => [
                    'https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js',
                    // You can add more global JavaScript files here
               ],
          ],
     ],

     #THEME_VENDORS  Define vendor assets specific to certain pages or components
     'THEME_VENDORS' => [
          'demo' => [
               // CSS files for the login page or component
               'css' => [
                    'assets/css/demo.css',
               ],
               // JavaScript files for the login page or component
               'js'  => [
                    'assets/js/demo.js',
               ],
          ],
          // You can add more as per your requirement
     ],
];
```

### Step 4: Usage 🤔

[](#step-4-usage-)

#### Create a Controller

[](#create-a-controller)

Generate a basic controller:

```
php artisan make:controller HomeController
```

#### Create a View

[](#create-a-view)

Create a view for your application:

```
php artisan make:view home
```

This will create `home.blade.php` in `resources/views`.

#### Subdirectory Controller

[](#subdirectory-controller)

To create a controller in a subfolder, use:

```
php artisan make:controller Dashboard/HomeController
```

This creates `HomeController` under `app/Http/Controllers/Dashboard`.

#### Subdirectory View

[](#subdirectory-view)

For views in subdirectories:

```
php artisan make:view dashboard.home
```

Creates `home.blade.php` in `resources/views/dashboard`.

### Step 4: Define Routes

[](#step-4-define-routes)

#### Home Route:

[](#home-route)

```
Route::get('/', [App\Http\Controllers\HomeController::class, 'index']);
```

#### Dashboard Route:

[](#dashboard-route)

```
Route::get('/dashboard', [App\Http\Controllers\Dashboard\HomeController::class, 'dashboard']);
```

Ensure you have matching controller methods, like so:

```
// HomeController.php
namespace App\Http\Controllers;

class HomeController extends Controller
{
    public function index()
    {
        addWebAsset(['home']);
        return view('home');
    }
}

// Dashboard/HomeController.php
namespace App\Http\Controllers\Dashboard;

class HomeController extends Controller
{
    public function dashboard()
    {
        addVendors(['demo']);
        return view('dashboard.home');
    }
}
```

### Step 5: Use Layout Components

[](#step-5-use-layout-components)

Add the layout components in your Blade files:

#### Home Layout (Front-End)

[](#home-layout-front-end)

```

    Welcome to the Front-End 👋

```

#### Dashboard Layout

[](#dashboard-layout)

```

    Welcome to the Dashboard 👋

```

### Blade Directives for Scripts and Styles

[](#blade-directives-for-scripts-and-styles)

To include page-specific styles and scripts:

```

@push('page_styles')

@endpush

@push('page_scripts')

@endpush
```

### Page Title Setup

[](#page-title-setup)

To set the page title dynamically:

```
// HomeController.php
public function index()
{
    addWebAsset(['home', 'jq']);
    $data['title'] = 'Home Page';
    return view('home', $data);
}
```

And in your view:

```

    @section('title', $title)
    Welcome to the Home Page 👋

```

---

### License

[](#license)

The MIT License (MIT). See the License file for details.

> GitHub [@eramitgupta](https://github.com/eramitgupta) ·
> LinkedIn [@eramitgupta](https://www.linkedin.com/in/eramitgupta/) ·
> Support [Donate](https://paypal.me/teamdevgeek/)

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~94 days

Total

3

Last Release

665d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/72160684?v=4)[Er Amit Gupta](/maintainers/eramitgupta)[@eramitgupta](https://github.com/eramitgupta)

---

Top Contributors

[![eramitgupta](https://avatars.githubusercontent.com/u/72160684?v=4)](https://github.com/eramitgupta "eramitgupta (24 commits)")

---

Tags

laravellaravellayoutslayoutmanagementphp-libraryphpframeworkwebdevelopment

### Embed Badge

![Health badge](/badges/erag-laravel-setup-layout/health.svg)

```
[![Health](https://phpackages.com/badges/erag-laravel-setup-layout/health.svg)](https://phpackages.com/packages/erag-laravel-setup-layout)
```

###  Alternatives

[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3851.2M](/packages/limenius-react-bundle)[area17/laravel-auto-head-tags

Laravel Auto Head Tags helps you build the list of head elements for your app

4616.1k](/packages/area17-laravel-auto-head-tags)[ktquez/laravel-tinymce

TinyMCE editor for Laravel and Lumen Framework

2525.4k](/packages/ktquez-laravel-tinymce)[jelix/wikirenderer

WikiRenderer is a library to generate HTML or anything else from wiki content.

1712.3k1](/packages/jelix-wikirenderer)[webkinder/sproutset

A Composer package for handling responsive images in Roots Bedrock + Sage + Blade projects.

282.2k](/packages/webkinder-sproutset)

PHPackages © 2026

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