mikelmi / mks-theme by mikelmi

Theme support for Laravel
59
0
1
Package Data
Maintainer Username: mikelmi
Maintainer Contact: mikelmi84@gmail.com (mike_lmi)
Package Create Date: 2016-09-26
Package Last Update: 2017-02-20
Language: PHP
License: MIT
Last Refreshed: 2024-11-11 15:11:11
Package Statistics
Total Downloads: 59
Monthly Downloads: 2
Daily Downloads: 1
Total Stars: 0
Total Watchers: 1
Total Forks: 0
Total Open Issues: 0

Theme Support for Laravel 5

This package supports the management view files and assets under separate folders in Laravel projects.

Installation

  1. Installation with
    composer require mikelmi/mks-theme:dev-master
  1. Add the service provider in config/app.php, to providers:
    Mikelmi\MksTheme\Providers\MksThemeServiceProvider::class,
  1. Add Facade alias in config/app.php, to aliases:
    'Theme' => Mikelmi\MksTheme\Facades\Theme::class,
  1. Publish config
    php artisan vendor:publish --provider="Mikelmi\MksTheme\Providers\MksThemeServiceProvider"

Create/configure theme

  1. Create new folder in public/themes/, for example public/themes/cool-theme
  2. Set your theme in config/theme.php:
    'name' => 'cool-theme'
    ...
  1. Now you can overwrite any view from resources/views within the folder public/themes/cool-theme/views

Usage

    Theme::set('theme-name');          // switch to 'theme-name'
    Theme::get();                      // retrieve current theme's name
    Theme::all();                      // retrieve collection with all themes
    Theme::asset('assets/path')        // retrieve url to theme asset (e.g.: Theme::asset('assets/css/styles.css')) 
    Theme::info('key'/** or null */);  // retrive theme info (from file /themes/theme-name/theme.php)