codewithtony/larathemes

Theme Manager for Laravel 5
3,162 12
Install
composer require codewithtony/larathemes
Latest Version:1.2
PHP:>=5.4.0
Laravel:5
License:MIT
Last Updated:Apr 1, 2017
Links: GitHub  ·  Packagist
Maintainer: codefromtony

Laravel Theme

The simpliest of theme switching for Laravel 5

  • Installation
  • Usage

Installation

Laravel 5.1+

Install Laravel Theme manager:

composer require codewithtony/larathemes

At config/app.php, add the Service Provider and the Facade:

    'providers' => [
        Tony\Themes\ThemeServiceProvider::class,
    ]

    //...

    'aliases' => [
        'Theme' => Tony\Themes\Themes\ThemeFacade::class,
    ]

Usage

Recommended Structure

themes
  ├── [theme name]
  |   └── assets
  |   └── views
  |
  └── [theme name]
      └── assets
      └── views

Setting a theme

Changing your theme is easy

Theme::set('my-theme')

Easily use the Middleware to change themes for an entire group

Route::group(['prefix' => 'admin', 'middleware' => ['auth', 'theme:admin'], function () {
    //...
});

Calling a view

Load your views like normal, Laravel Theme will look for your view in the set theme and if it isn't found, view finding will remain the same

You can reuse views by storing them outside of your theme and just uses view('layout.master') and have your layout/master.blade.php inside you themes.

Assets

Your assets will need to be sent to your public folder still.

Contribute

Your help is more than welcome!

License

Licensed under the The MIT License (MIT). Please see LICENSE for more information.

Related Packages

fivesqrd/fluent-laravel

A Laravel 5 service provider for including the Fluent PHP library.

3,160 0
rafflesargentina/l5-resource-controller

Repository pattern based Resource Controller, for use with Caffeinated Repositor...

304 0
petercoles/themes

Opinionated theme manager for Laravel

88 4

Version History

Version Released PHP Laravel License
1.2 >=5.4.0 5.* MIT
1.1 >=5.4.0 5.* MIT
1.0 >=5.4.0 5.* MIT