Download the PHP package yaap/theme without Composer
On this page you can find all versions of the php package yaap/theme. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package theme
Theme support for Laravel
Inspired by bigecko/laravel-theme. Themes are stored inside default laravel's resources folder
Introduction
This package provides a simple way to manage themes in Laravel applications.
For example, you can develop multiple themes for your application and easily switch between themes for different purposes.
Requirements
This version requires PHP 8.1 and supports Laravel 10-11.
This package also provides support for Laravel Mix and Vite configurations.
Themes | L5.5 | L5.6 | L5.7 | L5.8 | L6 | L7 | L8 | L9 | L10 | L11 |
---|---|---|---|---|---|---|---|---|---|---|
2.4 | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: |
3.0 | :x: | :x: | :x: | :x: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: |
4.1 | :x: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: |
5.0 | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :x: |
5.1 | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: |
Installation
To get the latest version, simply require the project using Composer:
or manually add line to composer.json
Optionally, publish config using artisan CLI (if you want to overwrite default config).
Configuration
Package config
Config in config/theme.php
file.
Theme config
Config in theme folder. Placeholder %theme_name%
will be replaced with theme name on creation.
Usage
Create theme with artisan CLI
Create command
The first time you have to create theme default
structure, using the artisan command:
By default, it will use vite
as assets builder. If you want to use laravel mix
instead, use the command:
or with laravel mix:
Destroy command
To delete an existing theme, use the command:
Structure
Here is an example of the folder structure of project with theme
Init theme
To init and use theme in your application, add the following code to any boot
method in application service provider (e.g. AppServiceProvider
):
This will add to views find path:
themes/{$name}/views
Lang files will be added as well:
themes/{$name}/lang
Making view
Assets
Vite
If you use Vite, ensure vite.config.js
have specified the input path for theme
Because app.js includes app.scss you can use the following code to include assets in your views:
Laravel Mix
If you use Laravel Mix, ensure webpack.mix.js
have specified mix configuration for theme
Then you can use the following code to include assets in your views:
in the <head>
tag
and before </body>
tag
To use images, you can use the following code:
Building layouts
Layouts using Components
Layouts using template inheritance
To build layouts we use template inheritance.
You can use @extends
directive to specify a parent layout.
Fallback capability
You still able to use default View::make('emails.notify')
which is stored outside the themes
directory.
Can I hire you guys?
Yes! Say hi: [email protected]
We will be happy to work with you! Other work we’ve done
Follow us
Stay up to date with the latest news! Follow us on LinkedIn or Facebook
License
MIT license.