PHPackages                             rdcstarr/laravel-themes - 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. rdcstarr/laravel-themes

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

rdcstarr/laravel-themes
=======================

A simple themes package for Laravel.

v1.2.2(5mo ago)030MITPHPPHP ^8.0

Since Sep 13Pushed 5mo agoCompare

[ Source](https://github.com/rdcstarr/laravel-themes)[ Packagist](https://packagist.org/packages/rdcstarr/laravel-themes)[ Docs](https://github.com/rdcstarr/laravel-themes)[ RSS](/packages/rdcstarr-laravel-themes/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (12)Versions (24)Used By (0)

🎨 Laravel Themes
================

[](#-laravel-themes)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c38e33c6375bc88562326f91a821d0a3d5bfcfe80411288203bed1433d2dc17f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72646373746172722f6c61726176656c2d7468656d65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rdcstarr/laravel-themes)[![GitHub Tests Action Status](https://camo.githubusercontent.com/86f7d220c1fac1dd49017ecdbcef47a66080c541aae82220d923ae50ffa09967/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72646373746172722f6c61726176656c2d7468656d65732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/rdcstarr/laravel-themes/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/c0138446e8ddc7d6f6fa9d20cea3bf3f0baf20dcb1f7622b9b7c0b338c6e6dce/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f72646373746172722f6c61726176656c2d7468656d65732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/rdcstarr/laravel-themes/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/943f08bdb705a757854817f86125fce3a45b4da0c6845c4212659dbb0392cae2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72646373746172722f6c61726176656c2d7468656d65732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rdcstarr/laravel-themes)

> A powerful and flexible Laravel package for theme management with seamless Vite integration.

✨ Features
----------

[](#-features)

- 🎨 **Easy Theme Management** - Add, list, and remove themes with simple Artisan commands 🛠️
- ⚡ **Vite Integration** - Full Vite support with hot reload and optimized builds ⚡️🔥
- 🔄 **Inline Asset Rendering** - Render CSS/JS assets inline for performance optimization 🚀
- 📁 **Flexible Directory Structure** - Customize theme directories via configuration 🗂️
- 🎯 **Global Helper Functions** - Access themes anywhere with the `theme()` helper 🧩
- 🧩 **Blade Directives** - Convenient Blade directives for theme integration ✨
- 🚀 **Redis Caching** - Optimized performance with Redis caching support ⚡️🧠
- 📦 **Auto-Discovery** - Automatic service provider registration ✅

📦 Installation
--------------

[](#-installation)

Install the package via Composer:

```
composer require rdcstarr/laravel-themes
```

### ⚙️ Required Setup

[](#️-required-setup)

> 💡 **Important:** The Vite configuration is regenerated depending on which directories you change in `config/themes.php`.
>
> - If you only change `themes.directories.build` (the public/build path), you can update the Vite configuration without reinstalling themes by running `php artisan theme:publish-vite`
>
>     This updates Vite entries and build paths only.
> - If you change `themes.directories.resources` (the resources/themes path) — for example where theme views, CSS/JS and images live — you must run `php artisan theme:install`
>
>     `theme:install` validates and (re)creates theme resources and the Vite setup and may overwrite generated files.

1. **Install the theme package** (required first step):

    ```
    php artisan theme:install
    ```
2. **Publish the configuration file** (optional):

    ```
    php artisan vendor:publish --tag=theme-config
    ```

🛠️ Artisan Commands
-------------------

[](#️-artisan-commands)

🚀 **Install Theme Package** (required first):

```
php artisan theme:install [--force] [--manifest] [--tailwind]
```

Sets up the default theme and publishes Vite configuration files.

🎨 **Add a New Theme**:

```
php artisan theme:add {theme-name} [--manifest] [--tailwind]
```

Creates a complete theme structure with CSS, JS, views, and images directories. Use `--manifest` to also create a manifest.json file.

📋 **List Available Themes**:

```
php artisan theme:list
```

Shows all available themes with their paths.

🗑️ **Remove a Theme**:

```
php artisan theme:remove {theme-name} [--force]
```

Deletes the specified theme. Use `--force` to skip confirmation.

📝 **Create/Recreate Theme Manifest**:

```
php artisan theme:manifest-publish {theme-name} [--force]
```

Creates or recreates a manifest.json file for an existing theme. Use `--force` to skip confirmation when overwriting.

📑 **Manage Theme Manifest Fields**:

```
# List all fields in a theme's manifest
php artisan theme:manifest {theme-name} list

# Add a new field interactively
php artisan theme:manifest {theme-name} add

# Add a field with specific parameters
php artisan theme:manifest {theme-name} add --key=about.title --label="About Title" --type=text

# Remove a field
php artisan theme:manifest {theme-name} remove [--key=field-key]
```

Manage custom fields in theme manifest files for dynamic content configuration.

⚡ **Publish Vite Configuration**:

```
php artisan theme:publish-vite [--force]
```

Updates the Vite configuration file with theme support.

🎯 Theme API
-----------

[](#-theme-api)

**Basic Operations**:

```
// Get the current theme instance 🧭
theme()

// Set the current theme 🎚️
theme()->set('theme-name');

// Get the current theme name 🏷️
theme()->name();

// Check if a theme exists ✅
theme()->exists('theme-name');

// Get all available themes 📚
theme()->getAll();
```

**Path Helpers**:

```
theme()->basePath();  // Base path for all themes
theme()->path();      // Current theme path
theme()->viewsPath(); // Views directory
theme()->jsPath();    // JavaScript file path
theme()->cssPath();   // CSS file path
```

**Vite Integration**:

```
theme()->viteJs();                // Vite JS entry point
theme()->viteCss();               // Vite CSS entry point
theme()->viteImages();            // Vite images directory
theme()->getBuildDirectoryPath(); // Build output directory
theme()->getHotFile();            // Hot reload file
```

🎨 Blade Directives
------------------

[](#-blade-directives)

**Theme Information**:

```
{{-- Display current theme name --}}
@themeName
```

**Asset Integration**:

```
{{-- Standard Vite assets (requires Vite dev server or build) --}}
@vite(theme()->viteCss())
@vite(theme()->viteJs())

{{-- Standard Vite assets (requires Vite dev server or build) --}}
@viteCss // with auto path to theme()->viteCss()
@viteJs  // with auto path to theme()->viteJs()

{{-- Inline assets (injects CSS/JS directly into HTML) --}}
@viteCssInline
@viteJsInline

{{-- Custom inline assets --}}
@viteInline([theme()->viteCss(), theme()->viteJs()])
```

**Images with Vite**:

```
{{-- In your Blade templates --}}

```

### ⚙️ Configuration

[](#️-configuration)

The `config/themes.php` file allows you to customize directories:

```
return [
    'default' => env('THEME_DEFAULT', 'default'),

    'directories' => [
        'resources' => 'themes', // complete path will be `./resources/themes`
        'build'     => 'themes', // complete path will be `./public/themes`
    ],
];
```

🔥 Vite Development
------------------

[](#-vite-development)

🏁 **Start development server for a specific theme**:

```
npm run dev --theme=my-theme
```

🏢 **Build assets for production**:

```
npm run build --theme=my-theme
```

**Vite Configuration Features**:

- ✅ Theme-specific hot reload files
- ✅ Automatic theme directory validation
- ✅ Asset path resolution
- ✅ Full page reload on view changes

📁 Theme Structure
-----------------

[](#-theme-structure)

Each theme follows this organized structure:

```
resources/themes/my-theme/
├── css/
│   └── app.css          # Main CSS file
├── js/
│   └── app.js           # Main JavaScript file
├── images/              # Theme images
└── views/               # Blade templates
    └── welcome.blade.php

```

🚆 Middleware Integration:
-------------------------

[](#-middleware-integration)

```
// Set theme based on your preferences
public function handle($request, Closure $next)
{
    theme()->set('theme_name' ?? 'default');

    return $next($request);
}
```

⚡ Performance Features
----------------------

[](#-performance-features)

**Redis Caching**:

- ✅ Automatic caching when Redis is configured 🧠
- ✅ Theme existence checks cached for 30 seconds ⏱️
- ✅ Manifest files cached for 30 seconds 📦
- ✅ Asset content cached for 30 seconds 💾

**Inline Asset Benefits**:

- ✅ Reduces HTTP requests 🌐
- ✅ Eliminates render-blocking resources 🚫🧱
- ✅ Perfect for critical CSS/JS 🚀
- ✅ Automatic caching in production ✅

🧪 Testing
---------

[](#-testing)

```
composer test
```

📖 Resources
-----------

[](#-resources)

- [Changelog](CHANGELOG.md) for more information on what has changed recently. ✍️

👥 Credits
---------

[](#-credits)

- [Rdcstarr](https://github.com/rdcstarr) 🙌

📜 License
---------

[](#-license)

- [License](LICENSE.md) for more information. ⚖️

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance70

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

Recently: every ~17 days

Total

23

Last Release

169d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laravellaravel-themesRdcstarr

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/rdcstarr-laravel-themes/health.svg)

```
[![Health](https://phpackages.com/badges/rdcstarr-laravel-themes/health.svg)](https://phpackages.com/packages/rdcstarr-laravel-themes)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)

PHPackages © 2026

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