qirolab/laravel-themer
Composer 安装命令:
composer require qirolab/laravel-themer
包简介
A Laravel theme manager, that will help you organize and maintain your themes inside Laravel projects.
README 文档
README
This Laravel package adds multi-theme support to your application. It also provides a simple authentication scaffolding for a starting point for building a Laravel application. And it also has preset for Bootstrap, Tailwind, Vue, and React. So, I believe it is a good alternative to the laravel/ui & laravel/breeze package.
Features
- Any number of themes
- Fallback theme support (WordPress style); It allows creating a child theme to extend any theme
- Provides authentication scaffolding similar to
laravel/ui&laravel/breeze - Exports all auth controllers, tests, and other files similar to
laravel/breeze - Provides frontend presets for
Bootstrap,Tailwind,Vue 2,Vue 3andReact
If you don't want to use auth scaffolding of this package, instead you want to use Laravel Fortify, no problem with that. You can use Laravel Themer with Fortify. Laravel Fortify only gives backend implementation authentication, it does not provide views or frontend presets. So, use Fortify for backend auth and Laravel Themer for views and presets.
Tutorial
Here is the video for Laravel Themer Tutorial.
Installation and setup
NOTE:
Laravel Themer v2.x and the above versions support Vite. If you want to use Laravel Mix then try Laravel Themer v1.7.1
You can install this package via composer using:
composer require qirolab/laravel-themer
Publish a configuration file:
php artisan vendor:publish --provider="Qirolab\Theme\ThemeServiceProvider" --tag="config"
Creating a theme
Run the following command in the terminal:
php artisan make:theme
This command will ask you to enter theme name, CSS framework, js framework, and optional auth scaffolding.
Useful Theme methods:
// Set active theme Theme::set('theme-name'); // Get current active theme Theme::active(); // Get current parent theme Theme::parent(); // Clear theme. So, no theme will be active Theme::clear(); // Get theme path Theme::path($path = 'views'); // output: // /app-root-path/themes/active-theme/views Theme::path($path = 'views', $themeName = 'admin'); // output: // /app-root-path/themes/admin/views Theme::getViewPaths(); // Output: // [ // '/app-root-path/themes/admin/views', // '/app-root-path/resources/views' // ]
Middleware to set a theme
Register ThemeMiddleware in app\Http\Kernel.php:
protected $routeMiddleware = [ // ... 'theme' => \Qirolab\Theme\Middleware\ThemeMiddleware::class, ];
Examples for middleware usage:
// Example 1: set theme for a route Route::get('/dashboard', 'DashboardController@index') ->middleware('theme:dashboard-theme'); // Example 2: set theme for a route-group Route::group(['middleware'=>'theme:admin-theme'], function() { // "admin-theme" will be applied to all routes defined here }); // Example 3: set child and parent theme Route::get('/dashboard', 'DashboardController@index') ->middleware('theme:child-theme,parent-theme');
Asset compilation
To compile the theme assets, first you need to add the following lines in the scripts section of the package.json file.
"scripts": {
...
"dev:theme-name": "vite --config themes/theme-name/vite.config.js",
"build:theme-name": "vite build --config themes/theme-name/vite.config.js"
}
Now, to compile a particular theme run the following command:
npm run dev:theme-name
# or
npm run build:theme-name
Testing
composer test
Support us
We invest a lot of resources into video tutorials and creating open-source packages. If you like what I do or if you ever made use of something I built or from my videos, consider supporting us. This will allow us to focus even more time on the tutorials and open-source projects we're working on.
Thank you so much for helping us out! 🥰
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
Authentication scaffolding stubs and presets are taken from laravel/ui, laravel/breeze, and laravel-frontend-presets/tailwindcss.
License
The MIT License (MIT). Please see License File for more information.
qirolab/laravel-themer 适用场景与选型建议
qirolab/laravel-themer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 274.87k 次下载、GitHub Stars 达 401, 最近一次更新时间为 2021 年 01 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「theme」 「laravel」 「laravel-theme」 「qirolab」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 qirolab/laravel-themer 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 qirolab/laravel-themer 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 qirolab/laravel-themer 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A Bootstrap 4.x base theme for SilverStripe
Lucency Theme
Laravel theme manager, that will help you organize and maintain your themes inside Laravel projects.
Selectize Theme for Bootstrap 4
Alfabank REST API integration
Themes allow you to create and switch between themes in your Laravel app.
统计信息
- 总下载量: 274.87k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 405
- 点击次数: 14
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-01-02