PHPackages                             velka/theme - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. velka/theme

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

velka/theme
===========

Theme support for Laravel with assets, theme extends etc. (this fork add support for typescript, tailwind &amp; meta json file theme:create-v2)

v1.0.1(1y ago)019MITPHPPHP ^8.1

Since Sep 23Pushed 1y agoCompare

[ Source](https://github.com/Velka-DEV/Theme)[ Packagist](https://packagist.org/packages/velka/theme)[ RSS](/packages/velka-theme/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (5)Used By (0)

Theme support for Laravel
=========================

[](#theme-support-for-laravel)

Inspired by [bigecko/laravel-theme](https://github.com/harryxu/laravel-theme). Themes are stored inside default laravel's resources folder

Introduction
------------

[](#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
------------

[](#requirements)

This version requires [PHP](https://www.php.net/) 8.1 and supports [Laravel](https://laravel.com/) 10-11.

This package also provides support for [Laravel Mix](https://laravel-mix.com/) and [Vite](https://vitejs.dev/) configurations.

ThemesL5.5L5.6L5.7L5.8L6L7L8L9L10L112.4✅✅✅✅❌❌❌❌❌❌3.0❌❌❌❌✅❌❌❌❌❌4.1❌❌❌❌❌❌✅✅✅❌5.0❌❌❌❌❌❌❌❌✅❌5.1❌❌❌❌❌❌❌❌✅✅Installation
------------

[](#installation)

To get the latest version, simply require the project using [Composer](https://getcomposer.org/):

```
composer require "yaap/theme:^5.0"
```

or manually add line to `composer.json`

```
{
    "require": {
        "yaap/theme": "^5.0"
    }
}
```

Optionally, publish config using artisan CLI (if you want to overwrite default config).

```
php artisan vendor:publish --provider="YAAP\Theme\ThemeServiceProvider"
```

Configuration
-------------

[](#configuration)

### Package config

[](#package-config)

Config in `config/theme.php` file.

```
return [

    /*
    |--------------------------------------------------------------------------
    | Path to directory with themes
    |--------------------------------------------------------------------------
    |
    | The directory with your themes.
    |
    */

    'path' => base_path('themes'),

    /*
    |--------------------------------------------------------------------------
    | Path to directory with assets build
    |--------------------------------------------------------------------------
    |
    | The directory with assets build in public directory.
    |
    */

    'assets_path' => 'themes',

    /*
    |--------------------------------------------------------------------------
    | A pieces of theme collections
    |--------------------------------------------------------------------------
    |
    | Inside a theme path we need to set up directories to
    | keep "layouts", "assets" and "partials".
    |
    */

    'containerDir' => [
        'assets' => 'assets',
        'lang' => 'lang',
        'layout' => 'views/layouts',
        'partial' => 'views/partials',
        'view' => 'views',
    ],
];
```

### Theme config

[](#theme-config)

Config in theme folder. Placeholder `%theme_name%` will be replaced with theme name on creation.

```
return [

    /*
    |--------------------------------------------------------------------------
    | Theme name
    |--------------------------------------------------------------------------
    |
    | Use in assets publishing etc.
    |
    */

    'name' => '%theme_name%',

    /*
    |--------------------------------------------------------------------------
    | Inherit from another theme
    |--------------------------------------------------------------------------
    |
    | Set up inherit from another if the file is not exists.
    |
    */

    'inherit' => null,

];
```

Usage
-----

[](#usage)

### Create theme with artisan CLI

[](#create-theme-with-artisan-cli)

#### Create command

[](#create-command)

The first time you have to create theme `default` structure, using the artisan command:

```
php artisan theme:create default
```

By default, it will use `vite` as assets builder. If you want to use `laravel mix` instead, use the command:

or with laravel mix:

```
php artisan theme:create default mix
```

#### Destroy command

[](#destroy-command)

To delete an existing theme, use the command:

```
php artisan theme:destroy default
```

### Structure

[](#structure)

Here is an example of the folder structure of project with theme

```
project-root
├── app/

├── public/
|   ├── index.php
|   └── themes/
|       └── default/
|           ├── js/
|           |   └── app.js
|           ├── css/
|           |   └── styles.css
|           └── images/
|               └── icon.png
├── resources/

├── themes/
|   ├── default/
|   |   ├── assets/
|   |   ├── lang/
|   |   ├── views/
|   |   |   ├── layouts/
|   |   |   ├── partials/
|   |   |   └── hello.blade.php
|   |   └── config.php
|   ├── admin/
|   ├── views/
|       ├── emails/
|       |   └── notify.blade.php
|       └── hello.blade.php

```

Init 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`):

```
use YAAP\Theme\Facades\ThemeLoader;

class AppServiceProvider extends ServiceProvider
{
    public function boot()
    {
        ThemeLoader::init('default');
    }
}
```

This will add to views find path:

- `themes/{$name}/views`

Lang files will be added as well:

- `themes/{$name}/lang`

### Making view

[](#making-view)

> [Laravel: Creating &amp; Rendering Views](https://laravel.com/docs/10.x/views#creating-and-rendering-views)

```
View::make('hello');
View::make('emails.notify');

// or

view('hello');
view('emails.notify');
```

### Assets

[](#assets)

#### Vite

[](#vite)

If you use **Vite**, ensure `vite.config.js` have specified the input path for theme

```
import {defineConfig} from 'vite';
import laravel from 'laravel-vite-plugin';

export default defineConfig({
    plugins: [
        laravel({
            input: [
                'themes/default/assets/js/app.js', // for default theme
                // ...
            ],
            refresh: true,
        }),
    ],
});
```

Because **app.js** includes **app.scss** you can use the following code to include assets in your views:

```

    @vite([
        'themes/default/assets/js/app.js',
    ])

```

#### Laravel Mix

[](#laravel-mix)

If you use **Laravel Mix**, ensure `webpack.mix.js` have specified mix configuration for theme

```
const mix = require('laravel-mix');

mix.disableNotifications();
mix.browserSync({
    open: true,
    proxy: 'localhost:8000',
    files: [
        'app/**/*',
        'routes/**/*',
        'themes/**/*', // manually add this line
    ]
});

// other configutraions...

// mix for default theme
mix.copyDirectory('themes/default/assets/img', 'public/themes/default/img');
mix.copyDirectory('themes/default/assets/fonts', 'public/themes/default/fonts');
// js
mix.js(['themes/default/assets/js/app.js'], 'public/themes/default/js/app.min.js')
// sass
mix.sass('themes/default/assets/sass/app.scss', 'public/themes/default/css/app.min.css')
```

Then you can use the following code to include assets in your views:

in the `` tag

```

```

and before `` tag

```

```

To use images, you can use the following code:

```

```

### Building layouts

[](#building-layouts)

#### Layouts using Components

[](#layouts-using-components)

> [Laravel: Blade Components](https://laravel.com/docs/10.x/blade#components)

#### Layouts using template inheritance

[](#layouts-using-template-inheritance)

To build layouts we use [template inheritance](https://laravel.com/docs/10.x/blade#layouts-using-template-inheritance). You can use `@extends` directive to specify a parent layout.

```
@extends('layouts.master')

@include('partials.header')

@section('content')

        HOME

@stop

@include('partials.footer')
```

### Fallback capability

[](#fallback-capability)

You still able to use default `View::make('emails.notify')` which is stored outside the `themes` directory.

Can I hire you guys?
--------------------

[](#can-i-hire-you-guys)

Yes! Say hi:

We will be happy to work with you! Other [work we’ve done](https://hexide-digital.com/)

### Follow us

[](#follow-us)

Stay up to date with the latest news! Follow us on [LinkedIn](https://www.linkedin.com/company/hexide-digital)or [Facebook](https://www.facebook.com/hexide.digital)

License
-------

[](#license)

[MIT](https://github.com/yaapis/Theme/blob/master/LICENSE) license.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

602d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/64b5f0ddfb4df01016efb93855c0ceed47054871fe72ff3cbeac7379b7f6cb49?d=identicon)[Velka-DEV](/maintainers/Velka-DEV)

---

Top Contributors

[![yaapis](https://avatars.githubusercontent.com/u/390195?v=4)](https://github.com/yaapis "yaapis (48 commits)")[![cth-latest](https://avatars.githubusercontent.com/u/59120414?v=4)](https://github.com/cth-latest "cth-latest (26 commits)")[![Oleksandr-Moik](https://avatars.githubusercontent.com/u/50796878?v=4)](https://github.com/Oleksandr-Moik "Oleksandr-Moik (21 commits)")[![sroutier](https://avatars.githubusercontent.com/u/3011606?v=4)](https://github.com/sroutier "sroutier (5 commits)")[![snipe](https://avatars.githubusercontent.com/u/197404?v=4)](https://github.com/snipe "snipe (4 commits)")[![terion-name](https://avatars.githubusercontent.com/u/1060205?v=4)](https://github.com/terion-name "terion-name (1 commits)")

---

Tags

laravelthemelayoutasset

###  Code Quality

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/velka-theme/health.svg)

```
[![Health](https://phpackages.com/badges/velka-theme/health.svg)](https://phpackages.com/packages/velka-theme)
```

###  Alternatives

[teepluss/theme

Theme will help you organize your themes inside Laravel projects easily and maintain its related assets, layouts and partials for the theme in single directory.

543174.1k8](/packages/teepluss-theme)[yaap/theme

Theme support for Laravel with assets, theme extends etc.

9544.1k2](/packages/yaap-theme)[facuz/laravel-themes

Theme will help you organize your themes inside Laravel projects easily and maintain its related assets, layouts and partials for the theme in single directory. (Based on teepluss/theme)

13843.0k2](/packages/facuz-laravel-themes)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
