vpominchuk / laravel-theme
Add theme support for your Laravel application
Requires
- php: ^7.4|^8.0
- illuminate/support: ^7.0|^8.0|^9.0
README
Laravel Multiple Theme
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.
Installation
$ composer require vpominchuk/laravel-theme $ php artisan vendor:publish --tag=theme-config
Converting your views to a theme
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.
Available artisan commands
To get list of available artisan commands try:
$ php artisan theme list
Switching between themes
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);
Customizing ThemeManager
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.
Security
If you discover any security related issues, please use the issue tracker.
Credits
Contributing
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.
License
The MIT License (MIT). Please see License File for more information.