Download the PHP package sunveloper/teepluss-themes without Composer
On this page you can find all versions of the php package sunveloper/teepluss-themes. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download sunveloper/teepluss-themes
More information about sunveloper/teepluss-themes
Files in sunveloper/teepluss-themes
Package teepluss-themes
Short Description Laravel 5 package providing multi-theme inherited cascading support for views and assets.
License MIT
Homepage https://github.com/laradic/themes
Informations about the package teepluss-themes
Laradic Themes for Laravel 5
Version 0.3
Laravel 5 package providing multi-theme inherited cascading support for views and assets.
- Easy and worry free setup Does not conflict with the standard Laravel view system.
- Template Languages Works with PHP, Blade, Twig and any other view engine.
- Cascading & Inheritance Themes are able to inherit all options from other themes, providing a smart and intuitive way to extend existing themes.
- Asset Management Dependable assets or asset groups with caching, minification, filters(scss, less, etc), etc.
- And much more...
Overview
- Overview
- Todo for 1.0
- Installation
- Composer
- Laravel
- Configuration
- First time usage guide and explenation
- Inheritance system basics
- Cascade system basics
- To create a namespace
- To create package
- Views/Themes
- Common methods overview
- Themes (Facade => ThemeFactory)
- Theme (instance of a theme)
- Common methods overview
- Assets
- AssetGroup
- The theme file
- Navigation/Breadcrumbs
- Console Commands
- List publishers
- Publish a theme
- Creating a theme
- Creating the initial theme structure (ment as example)
- Copyright/License
Todo for 1.0
- [ ] Proper/updated documentation (not this README.md file)
- [ ] Example application
- [ ] Unit tests for Assets
- [x] Jenkins, travis, etc
- [x] Unit tests for Themes
Installation
Composer
Laravel
Add the ThemesServiceProvider to your config.
Optionally, you can add any of the Facades below:
Configuration
<sub>[^](#top)</sub>
First time usage guide and explenation
Open up the laradic.config.php
file. For first time use, just change the theme folder path to your desired location.
Save it and run php artisan themes:init
. This will generate a few folders and files matching the default config settings.
It only serves as an example, showing the directory structure for a theme and theme view inheritance.
Loading a view file is the same as normal.
Inheritance system basics
Load priority
[Active Theme View Folder
]() > [Parent Theme View Folder
(if set)]() > [Default Theme View Folder
]() > [Default Laravel View Folder
]()
If you understand that, skip these points. Otherwise, more details about this:
- If you open the
index.blade.php
file, you see it @extends layout. - If there was a
layout.blade.php
file in the same folder, it would use that one (duhh). - However, that's not the case right now. So the Theme manager will start looking in other theme directories if they have the file (with the same relative path).
- It will first check the parent theme of 'example/main', defined in the theme.php file (or not, its optional).
- If its not there either, it will check the default theme. Which in this case, has the layout.blade.php file.
- If by any chance, the default folder doesn't have that file either, it will lastly check the standard Laravel view folder for that file.
The same goes for loading Views, Assets, etc.
Cascade system basics
To put it simply, every theme can have "sub-themes". Inside a theme folder, you notice the namespaces
and packages
folder.
To create a namespace
For example:
- create the
lingo
folder inside thenamespaces
folder of theexample/main
theme. - Inside that folder, create the
assets
andviews
folder. -
Create a
myview.blade.php
inside theview
folder - Create a
subdir/otherview.blade.php
inside theview
folder
To create package
A package need to be in 2 directories.
- So create the
foo/bar
folder inside thepackages
folder of theexample/main
theme. - Inside that folder, create the
assets
andviews
folder. -
Create a
hakker.blade.php
inside theview
folder - Create a
subdir/otherhakker.blade.php
inside theview
folder
The same goes for assets
Views/Themes
The active and default theme can be set in the configuration by altering the active
and default
keys.
You can set the active theme on the fly by using Theme::setActive('theme/slug')
.
You can set the default theme on the fly by using Theme::setDefault('theme/slug')
.
Common methods overview
Check out the API documentation for the full list of methods.
Themes (Facade => ThemeFactory)
Function call | Return type | Description |
---|---|---|
Themes::setActive($theme) |
self | Set the active theme, $theme can be a Theme instance or the slug string of that theme |
Themes::getActive() |
Theme | Returns the active theme |
Themes::setDefault($theme) |
self | Set the default theme, $theme can be a Theme instance or the slug string of that theme |
Themes::getDefault() |
Theme | Returns the default theme |
Themes::resolveTheme($slug) |
Theme | Resolve a theme using it's slug. It will check all theme paths for the required theme. |
Themes::all() |
string[] | Returns all resolved theme slugs |
Themes::get($slug) |
Theme | Returns the theme instance if the theme is found |
Themes::has($slug) |
bool | Check if a theme exists |
Themes::count() |
int | Get the number of themes |
Themes::addNamespace($name, $dirName) |
self | Add a namespace to the theme |
Themes::getPath($type) |
string | Get a path for the type (assets, views, namespaces, packages) |
Theme (instance of a theme)
Function call | Return type | Description |
---|---|---|
Theme::getConfig() |
array | The array from theme.php |
Theme::getParentTheme() |
Theme | .. |
Theme::getParentSlug() |
string | .. |
Theme::hasParent() |
bool | .. |
Theme::getSlug() |
string | .. |
Theme::getSlugKey() |
string | .. |
Theme::getSlugProvider() |
string | .. |
Theme::getName() |
string | .. |
Theme::isActive() |
bool | .. |
Theme::isDefault() |
bool | .. |
Theme::isBooted() |
bool | .. |
Theme::boot() |
void | .. |
Theme::getVersion() |
SemVer | .. |
Theme::getPath() |
string | .. |
Theme::getCascadedPath() |
string | .. |
Assets
The Asset
Facade links to AssetFactory
. It should not be confused with the Asset
class that Asset::make
returns, which actually holds asset data.
Note $path
is the same as with Views (namespaces, packages, etc)
Function call | Return type | Description |
---|---|---|
Asset::make($path); |
Asset<FileAsset> |
Returns the asset instance |
Asset::url($path); |
string | Returns the asset URL |
Asset::uri($path); |
string | Returns the asset uri |
Asset::script($path, array $attr = [ ], $secure = false)); |
string | Renders the asset in a <script src=""> tag |
Asset::style($path, array $attr = [ ], $secure = false)); |
string | Renders the asset in a <link ..> tag |
Asset::group($name); |
AssetGroup |
Returns an AssetGroup, more details below |
Asset::addGlobalFilter($extension, $callback); |
void | Add global Assetic filter, to be applied on all assets with matching extension |
Asset::setCachePath($path); |
string | Returns the filesystem path to the asset file |
Asset::getCachePath(); |
string | Returns the filesystem path to the asset file |
Asset::deleteAllCached(); |
string | Returns the filesystem path to the asset file |
Asset::setAssetClass("Full\Class\Name"); |
string | Returns the filesystem path to the asset file |
Asset::setAssetGroupClass("Full\Class\Name"); |
string | Returns the filesystem path to the asset file |
AssetGroup
Is used to group assets. Has several features you could use:
- Depencency management
- Minifaction & concenation
- Caching
The theme file
Beside the obvious fields, the boot field is rather important. Use the boot field closure to register namespaces for your theme, define assets and asset groups, and other global stuff.
Navigation/Breadcrumbs
Console Commands
List publishers
Publish a theme
Creating a theme
Creating the initial theme structure (ment as example)
Copyright/License
Copyright 2015 Robin Radic - MIT Licensed
All versions of teepluss-themes with dependencies
illuminate/support Version ^5.0 || ^6.0 || ^7.0 || ^8.0
illuminate/view Version ^5.0 || ^6.0 || ^7.0 || ^8.0
sunveloper/teepluss-support Version ^4.0.4
sunveloper/teepluss-console Version ^4.0.2
sunveloper/kriswallsmith-assetic Version ^1.4.0
vierbergenlars/php-semver Version ^3.0.2 || ^4.0 || ^5.0
laravelcollective/html Version ^5.0 || ^6.0 || ^7.0