A package that allows developers to implement multiple theme support to their Laravel applications quickly and easily.
Laravel Theme package allows you to convert your resources/views/
to independent theme.
Laravel Theme allows you to easily add multiple themes to your Laravel application. It provides the ability to create themes. It also offers a theme helper commands to allow for easy switch between themes, list available themes and more...
Laravel Theme is a great way to quickly add theme support to your Laravel application, allowing you to customize the look and feel of your app.
$ composer require vpominchuk/laravel-theme
$ php artisan vendor:publish --tag=theme-config
As long as your views located in resources/views/
you can convert them to a theme, just run:
$ php artisan theme:create
and answer some general question.
To get list of available artisan commands try:
$ php artisan theme list
Command | Description |
---|---|
theme:list |
Show available themes |
theme:info {theme_name} |
Get theme information |
theme:create |
Create a new theme |
theme:activate {theme_name} |
Activate theme |
You can easily switch between your themes in two different ways:
- Using artisan command
$ php artisan theme:activate {theme_name}
- Programmatically
use VPominchuk\LaravelThemeSupport\Contracts\ThemeManager;
/** @var ThemeManager $themeManager */
$themeManager = app(ThemeManager::class);
$themeManager->setActiveTheme($systemName);
By default, ThemeManager
class stores information about active theme in
framework/theme.json
file.
{
"active_theme": "default"
}
In real application you might want to use your own mechanism to store information about active theme.
Follow this documentation to make your own ThemeManager
implementation.
If you discover any security related issues, please use the issue tracker.
Feel free to make any suggestions on the issues or create a pull request. I'll be very happy.
See CONTRIBUTING.md for more information about how to contribute.
The MIT License (MIT). Please see License File for more information.