| Package Data | |
|---|---|
| Maintainer Username: | yaapis |
| Maintainer Contact: | yaapis@gmail.com (Biluk Andrey) |
| Package Create Date: | 2014-04-27 |
| Package Last Update: | 2024-03-25 |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-10-30 03:03:06 |
| Package Statistics | |
|---|---|
| Total Downloads: | 42,316 |
| Monthly Downloads: | 418 |
| Daily Downloads: | 47 |
| Total Stars: | 95 |
| Total Watchers: | 3 |
| Total Forks: | 24 |
| Total Open Issues: | 6 |
Inspired by bigecko/laravel-theme. Themes are stored inside default laravel's resources folder
Require this package in your composer.json:
"yaap/theme": "2.*"
And add the ServiceProvider to the providers array in config/app.php
'YAAP\Theme\ThemeServiceProvider',
Publish config using artisan CLI (if you want to overwrite default config).
php artisan vendor:publish --tag="config"
You can register the facade in the aliases key of your config/app.php file.
'aliases' => array(
'Theme' => 'YAAP\Theme\Facades\Theme'
)
return array(
'path' => base_path('resources/themes'),
'assets_path' => 'assets/themes',
);
return array(
'name' => 'default',
'inherit' => null,
);
##Usage
├── resources/
└── themes/
├── default/
| ├── layouts/
├── partials/
├── views/
| └── hello.blade.php
└── config.php
└── admin/
├── views/
| ├── emails/
| | └── notify.blade.php
| └── hello.blade.php
|
└── lang/
├── public/assets/
└── themes/
└── default/
├── css/
| └── styles.css
└── images/
└── icon.png
The first time you have to create theme "default" structure, using the artisan command:
php artisan theme:create default
To delete an existing theme, use the command:
php artisan theme:destroy default
###Init theme
Theme::init($name)
This will add to views find path:
View::make('hello');
View::make('emails.notify');
Assets can be nested too. Asset url can be automatically with version.
<link rel="stylesheet" href="{{ Theme::asset('css/styles.css', null, true) }}"/>
<link rel="stylesheet" href="{{ Theme::asset('css/ie.css', null, 'v1') }}"/>
The first one will get version from filemtime, the second one - from params
###Blade templates
@extends('layouts.master')
@include('partials.header')
@section('content')
<section id="main">
<h1>HOME</h1>
</section>
@stop
@include('partials.footer')
###Fallback capability
You still able to use default View::make('emails.notify') which is stored outside the themes directory