PHPackages                             roland/laravel-theme-manager - 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. [Templating &amp; Views](/categories/templating)
4. /
5. roland/laravel-theme-manager

ActiveLibrary[Templating &amp; Views](/categories/templating)

roland/laravel-theme-manager
============================

Laravel 5 Themes: Asset &amp; Views folder per theme. Theme inheritance. Blade integration and more...

1.1(7y ago)41272MITPHPPHP ^7.0

Since Jul 12Pushed 7y ago1 watchersCompare

[ Source](https://github.com/roladn/laravel-theme-manager)[ Packagist](https://packagist.org/packages/roland/laravel-theme-manager)[ Docs](https://rolandalla.com/contact)[ RSS](/packages/roland-laravel-theme-manager/feed)WikiDiscussions master Synced today

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

This package is a theme management package for Laravel with a set of tools to help you easily and quickly build a theme management system for your laravel based project. The goal of this package is to remain as flexible as possible and provide a way to use it internally.

Supports
--------

[](#supports)

VersionLaravel VersionPHP Version1.05.57.1, 7.2This package supports **Blade**, **PHP** and **Twig** template engines.

Features
--------

[](#features)

This package provides tools for the following:

- Change themes on runtime.
- Get theme meta infomations.
- Support fallback templates.
- Preview a theme using URL query parameter.
- Extend the theme functionalities.

\##Installation

To get started with this package, add the following lines to your `composer.json` file and run `composer update`.

```
"require": {
	"roland/laravel-theme-manager": "~1.0"
}
```

Or, Run `composer require` from your terminal to install the package via the Composer package manager:

```
composer require roland/laravel-theme-manager
```

Service Provider &amp; Facade
-----------------------------

[](#service-provider--facade)

If you disabled the laravel's automatic package discovery feature these will help you.

```
// Service Provider
Roland\Theme\ThemeServiceProvider::class,

// Facade
'Theme' => Roland\Theme\Facades\Theme::class,
```

Publish Configuration
---------------------

[](#publish-configuration)

Much of the package comes preconfigured, so that you can start building your API right away after you installed. You can either use `.env` file or `config/themes.php` to configure most of the package.

You also can publish the configuration file with the following Artisan command:

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

#### Enable or disable the package

[](#enable-or-disable-the-package)

You can set the value to true or false to enable or disable the package.

```
enable => true,

```

#### Default theme provider

[](#default-theme-provider)

Here you may specify which of the theme provider connections below you wish to use as your default provider.

> Available drivers: "file"

```
'driver' => 'file',

```

#### Default theme

[](#default-theme)

Here you may specify the default theme.

```
'theme' => 'default',

```

#### Themes path

[](#themes-path)

Here you may specify a path for themes.

```
'path' => base_path('resources/themes'),

```

\##Basic Usage

### Create a theme

[](#create-a-theme)

To create a theme, first, add a `themes` folder to the `resources` folder of your app.

Inside the `themes` folder, any folder you create with a `theme.json` the file represents a theme.

The folder structure will look like this:

```
resources
└── themes
    ├── [Theme folder]
    |   └── theme.json
    |   └── welcome.blade.php
    |
    └── [Another theme folder]
        └── theme.json
        └── welcome.blade.php

```

### Theme information file (theme.json)

[](#theme-information-file-themejson)

This package only recognize a folder as a theme when a file called `theme.json` exists.

This is the basic structure of the theme information file. You can add any number of key, value pairs to the file and retrieve later.

```
{
	"theme_title": "Default theme",
	"theme_description": "Default theme for the theme package",
	"theme_uri": "https://domain.com",
	"theme_version": "1.0.0",
	"theme_license": "The MIT License (MIT)",
	"theme_tags": "default, simple",
	"theme_type": "web",
	"author_name": "Jon Deep",
	"author_email": "JonDeep@domain.com",
	"author_uri": "https://domain.com"
}
```

### Basic methods

[](#basic-methods)

To simply display a view (welcome) using the current theme. Otherwise fallback (index).

```
return Theme::view(['welcome', 'index']);

```

To set the current theme on runtime.

```
return Theme::use('mytheme')->view(['welcome']);

```

To set the current theme and update the default config theme.

```
Theme::set('mytheme');

```

Add `theme` parameter to preview a theme on runtime.

```
https://localhost/?theme=mytheme

```

You also can change the theme provider at runtime.

```
return Theme::driver('file')->view(['welcome']);

```

To check whether a theme exists or not.

```
Theme::exists('mytheme');

```

To check all themes.

```
Theme::all();

```

Ps: it will return a json with all the installed themes

Return theme's information as `json`.

```
// Return default theme's info
return Theme::info();

// Return provided theme's info
return Theme::info('mytheme');
```

Pass data to views.

```
// with() method
return Theme::with(['name' => 'Victoria'])->view(['welcome']);

// Alternative way
return Theme::view(['welcome'], ['name' => 'Victoria']);
```

\##Advanced We allow you extend or add more theme providers using `extend` function on runtime without a hassle.

```
	Theme::extend('riak', function($app)
	{
		return 'Riak theme driver';
	});

	// Chnage the theme driver from route
	return Theme::driver('riak');
```

Configure Middleware

- Publish the package: `php artisan vendor:publish`
- On `Http/kernel.php` add to protected `'theme' => \App\Http\Middleware\CheckTheme::class,`
- Use middleware on the routes

Route example: ` Route::get('/', ['uses' => 'TestController@home'])->middleware('theme:ThemeName');`

ps. using the theme will allow you to use the deafult Laravel `view()` with the currect theme :)

License
-------

[](#license)

This package is licensed under the [The MIT License (MIT)](https://opensource.org/licenses/MIT).

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~4 days

Total

2

Last Release

2856d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b557b1c370b79ac29afb17f0e930efb036af781037464493f8aad255aee0c42d?d=identicon)[roladn](/maintainers/roladn)

---

Top Contributors

[![rolandalla](https://avatars.githubusercontent.com/u/5981015?v=4)](https://github.com/rolandalla "rolandalla (4 commits)")

---

Tags

packagebladelaravel 5assetsthemesviews

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/roland-laravel-theme-manager/health.svg)

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

###  Alternatives

[igaster/laravel-theme

Laravel Themes: Asset &amp; Views folder per theme. Theme inheritance. Blade integration and more...

5161.2M12](/packages/igaster-laravel-theme)[league/plates

Plates, the native PHP template system that's fast, easy to use and easy to extend.

1.5k5.9M232](/packages/league-plates)[larablocks/pigeon

A more flexible email message builder for Laravel 5 including chained methods, reusable message configurations, and message layout and template view management.

143.7k](/packages/larablocks-pigeon)

PHPackages © 2026

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