All Projects → qirolab → Laravel Themer

qirolab / Laravel Themer

Licence: mit
Multi theme support for Laravel application

Projects that are alternatives of or similar to Laravel Themer

Laravel Db Profiler
Database Profiler for Laravel Web and Console Applications.
Stars: ✭ 141 (-0.7%)
Mutual labels:  laravel, laravel-package
Laravel Emojione
Laravel package to make it easy to use the gorgeous emojis from EmojiOne
Stars: ✭ 133 (-6.34%)
Mutual labels:  laravel, laravel-package
Laravel Package Generator
A laravel package generator
Stars: ✭ 128 (-9.86%)
Mutual labels:  laravel, laravel-package
Laravel Meta
Metadata for Eloquent model
Stars: ✭ 124 (-12.68%)
Mutual labels:  laravel, laravel-package
Laravel Deletable
👾 Gracefully restrict deletion of Laravel Eloquent models
Stars: ✭ 137 (-3.52%)
Mutual labels:  laravel, laravel-package
Laravel Short Url
A Laravel package to shorten urls
Stars: ✭ 127 (-10.56%)
Mutual labels:  laravel, laravel-package
Laravel Paddle
Paddle.com API integration for Laravel with support for webhooks/events
Stars: ✭ 132 (-7.04%)
Mutual labels:  laravel, laravel-package
Eye
Eyewitness.io package for Laravel 5 applications
Stars: ✭ 114 (-19.72%)
Mutual labels:  laravel, laravel-package
Laravel Hashslug
Package providing a trait to use Hashids on a model
Stars: ✭ 136 (-4.23%)
Mutual labels:  laravel, laravel-package
Twitter
Twitter Notifications Channel for Laravel
Stars: ✭ 135 (-4.93%)
Mutual labels:  laravel, laravel-package
Laravel Mail Editor
MailEclipse ⚡ Laravel Mailable Editor!
Stars: ✭ 1,714 (+1107.04%)
Mutual labels:  laravel, laravel-package
Laravel Api Explorer
API explorer for laravel applications
Stars: ✭ 138 (-2.82%)
Mutual labels:  laravel, laravel-package
Pagination
🎁 Laravel 5 Custom Pagination Presenter
Stars: ✭ 119 (-16.2%)
Mutual labels:  laravel, laravel-package
Nova Belongsto Depend
Larave Nova BelongsTo Field with Dependcy
Stars: ✭ 128 (-9.86%)
Mutual labels:  laravel, laravel-package
Laravel Natural Language
This package makes using the Google Natural API in your laravel app a breeze with minimum to no configuration, clean syntax and a consistent package API.
Stars: ✭ 119 (-16.2%)
Mutual labels:  laravel, laravel-package
Eloquent Tree
Eloquent Tree is a tree model for Laravel Eloquent ORM.
Stars: ✭ 131 (-7.75%)
Mutual labels:  laravel, laravel-package
Laravel Fpdf
Create PDFs with Laravel, provides FPDF version 1.82
Stars: ✭ 108 (-23.94%)
Mutual labels:  laravel, laravel-package
Laravel Geo Routes
GeoLocation restricted routes for Laravel
Stars: ✭ 110 (-22.54%)
Mutual labels:  laravel, laravel-package
Simple Qrcode
An easy-to-use PHP QrCode generator with first-party support for Laravel.
Stars: ✭ 1,923 (+1254.23%)
Mutual labels:  laravel, laravel-package
Laravel Easypanel
A beautiful and flexible admin panel creator based on Livewire for Laravel
Stars: ✭ 135 (-4.93%)
Mutual labels:  laravel, laravel-package

Multi theme support for Laravel application

Latest Version on Packagist GitHub Tests Action Status Styling Psalm Total Downloads

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 3 and React

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

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
Create 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', '[email protected]')
    ->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', '[email protected]')
    ->middleware('theme:child-theme,parent-theme');

Asset compilation

To compile the theme assets, you need to add the theme's webpack.mix.js in the root webpack.mix.js.

// add this in the root `webpack.mix.js`
require(`${__dirname}/themes/theme-name/webpack.mix.js`);

Now you can run the npm install and npm run dev command to compile theme assets.

If you add multiple webpack.mix.js of different themes in the root webpack.mix.js, then webpack may not compile these correctly. So, you should modify the root webpack.mix.js with the following code:

let theme = process.env.npm_config_theme;

if(theme) {
   require(`${__dirname}/themes/${theme}/webpack.mix.js`);
} else {
    // default theme to compile if theme is not specified
  require(`${__dirname}/themes/theme-name/webpack.mix.js`);
}

Now, to compile a particular theme run the following command:

npm run dev --theme=theme-name

# or

npm run watch --theme=theme-name

# or

npm run production --theme=theme-name

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.

Buy Me A Coffee

Thank you so much for helping us out! 🥰

Testing

composer test

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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].