PHPackages                             viranet/vira-template-plugin-engine - 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. viranet/vira-template-plugin-engine

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

viranet/vira-template-plugin-engine
===================================

A package to manage templates and plugins in Laravel

0.1.0(1y ago)12MITPHPPHP &gt;=7.3

Since Dec 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Vira-Ecosystem/vira-template-plugin-engine)[ Packagist](https://packagist.org/packages/viranet/vira-template-plugin-engine)[ RSS](/packages/viranet-vira-template-plugin-engine/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Vira Template &amp; Plugin Manager for Laravel
==============================================

[](#vira-template--plugin-manager-for-laravel)

This project provides a Template and Plugin Manager for Laravel that allows you to easily manage and integrate templates and plugins. With this system, you can install, activate, deactivate, delete, update, and download templates and plugins. It also supports loading custom routes and views for each plugin and template. Additionally, metadata for each template and plugin can be read and displayed, providing detailed information about each item.

Features
--------

[](#features)

- Install, activate, deactivate, and delete templates and plugins.
- Check for updates and download the latest versions of templates and plugins.
- Metadata support for templates and plugins (preview image, version description, download link).
- Load routes and custom pages for plugins and templates dynamically.
- License validation for plugins.
- Search functionality for templates and plugins via a web service.
- Admin Panel Integration: View metadata, install, activate, deactivate, and delete templates and plugins directly from the admin interface.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.4
- Laravel &gt;= 8.0
- Composer

Installation
------------

[](#installation)

1. **Install via Composer**:

    Add the package to your Laravel project using Composer:

    ```
    composer require composer require viranet/vira-template-plugin-engine
    ```
2. **Publish Configuration**:

    Publish the configuration file to your `config` directory:

    ```
    php artisan vendor:publish --provider="ViraNet\TemplatePluginManager\ServiceProvider"
    ```

    This will create the `config/viranet-tp-engine.php` configuration file where you can adjust the paths, license API URL, and search API URL.
3. **Set Up Directories**:

    Make sure the `public/vira-tp/templates/` and `public/vira-tp/plugins/` directories exist in your project. If they don't, create them:

    ```
    mkdir -p public/vira-tp/templates
    mkdir -p public/vira-tp/plugins
    ```

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

[](#configuration)

The configuration file (`config/viranet-tp-engine.php`) contains the following settings:

```
return [
    'template_path' => storage_path('public/vira-tp/templates/'),
    'plugin_path' => storage_path('public/vira-tp/plugins/'),
    'license_api_url' => env('LICENSE_API_URL', 'https://license-server.com/api/validate'),
    'search_api_url' => env('SEARCH_API_URL', 'https://search-server.com/api/search'),
];
```

### .env

[](#env)

Ensure the following environment variables are set in your `.env` file:

```
LICENSE_API_URL=https://license-server.com/api/validate
SEARCH_API_URL=https://search-server.com/api/search
```

Admin Panel Integration
-----------------------

[](#admin-panel-integration)

### Displaying Metadata in Admin Panel

[](#displaying-metadata-in-admin-panel)

You can integrate the Template &amp; Plugin Manager into your admin panel by fetching and displaying metadata for templates and plugins. The metadata includes details like the name, description, version, preview image, and download link.

#### Example: Fetching and Displaying Metadata

[](#example-fetching-and-displaying-metadata)

In your admin panel controller, you can fetch and display metadata as follows:

```
use YourNamespace\TemplatePluginManager\TemplateManager;
use YourNamespace\TemplatePluginManager\PluginManager;

class AdminController extends Controller
{
    protected $templateManager;
    protected $pluginManager;

    public function __construct(TemplateManager $templateManager, PluginManager $pluginManager)
    {
        $this->templateManager = $templateManager;
        $this->pluginManager = $pluginManager;
    }

    // Show the templates in the admin panel
    public function showTemplates()
    {
        $templates = $this->getAllTemplates();
        return view('admin.templates.index', compact('templates'));
    }

    // Show the plugins in the admin panel
    public function showPlugins()
    {
        $plugins = $this->getAllPlugins();
        return view('admin.plugins.index', compact('plugins'));
    }

    private function getAllTemplates()
    {
        $templates = [];
        $templateDirs = glob(storage_path('public/vira-tp/templates/*'), GLOB_ONLYDIR);

        foreach ($templateDirs as $templateDir) {
            $templateName = basename($templateDir);
            $metadata = $this->templateManager->getTemplateMetadata($templateName);
            if ($metadata) {
                $templates[] = $metadata;
            }
        }

        return $templates;
    }

    private function getAllPlugins()
    {
        $plugins = [];
        $pluginDirs = glob(storage_path('public/vira-tp/plugins/*'), GLOB_ONLYDIR);

        foreach ($pluginDirs as $pluginDir) {
            $pluginName = basename($pluginDir);
            $metadata = $this->pluginManager->getPluginMetadata($pluginName);
            if ($metadata) {
                $plugins[] = $metadata;
            }
        }

        return $plugins;
    }
}
```

In the above code, the `getAllTemplates()` and `getAllPlugins()` methods fetch all templates and plugins, respectively, and read their metadata. You can then pass this data to your views and display it in your admin panel.

#### Example View for Templates (`resources/views/admin/templates/index.blade.php`)

[](#example-view-for-templates-resourcesviewsadmintemplatesindexbladephp)

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

@section('content')
    Templates

                Name
                Description
                Version
                Preview
                Actions

            @foreach($templates as $template)

                    {{ $template['name'] }}
                    {{ $template['description'] }}
                    {{ $template['version'] }}

                            @csrf
                            Activate

            @endforeach

@endsection
```

This view lists all the templates and their metadata (such as name, description, version, and preview image). You can customize this view to add action buttons like "Activate", "Deactivate", and "Delete" for each template.

### Admin Panel Routes

[](#admin-panel-routes)

You can define routes for the admin panel to manage templates and plugins:

```
// routes/web.php

use App\Http\Controllers\AdminController;

Route::prefix('admin')->name('admin.')->middleware(['auth', 'admin'])->group(function () {
    Route::get('templates', [AdminController::class, 'showTemplates'])->name('templates.index');
    Route::get('plugins', [AdminController::class, 'showPlugins'])->name('plugins.index');
    Route::post('templates/activate/{template}', [AdminController::class, 'activateTemplate'])->name('templates.activate');
    Route::post('plugins/activate/{plugin}', [AdminController::class, 'activatePlugin'])->name('plugins.activate');
});
```

These routes handle the display and management of templates and plugins in your admin panel.

Routes
------

[](#routes)

When you install a template or plugin, if it contains a `routes/web.php` file, the system will automatically load the routes for the template/plugin. This allows templates and plugins to define their custom routes without modifying the main `routes/web.php` file of your Laravel project.

#### Example of a Plugin Route File (`routes/web.php`)

[](#example-of-a-plugin-route-file-routeswebphp)

```
// Inside your plugin's routes/web.php

Route::get('/my-plugin', function () {
    return view('my-plugin::home');
});
```

Metadata Format
---------------

[](#metadata-format)

Each template and plugin should include a `metadata.json` file in their root directory. This file contains information about the template/plugin such as the name, version, description, preview image, and download URL.

#### Example `metadata.json` for a Plugin

[](#example-metadatajson-for-a-plugin)

```
{
    "name": "My Plugin",
    "version": "1.0.0",
    "description": "This is a powerful plugin for Laravel.",
    "preview_image": "https://example.com/plugin-preview.jpg",
    "download_url": "https://example.com/download/my-plugin.zip",
    "latest_version": "1.1.0"
}
```

#### Example `metadata.json` for a Template

[](#example-metadatajson-for-a-template)

```
{
    "name": "My Template",
    "version": "1.0.0",
    "description": "A beautiful template for your Laravel application.",
    "preview_image": "https://example.com/template-preview.jpg",
    "download_url": "https://example.com/download/my-template.zip",
    "latest_version": "1.1.0"
}
```

License
-------

[](#license)

This package is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.

Help to improve the package :D

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance41

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

520d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/07c4a89751a7857b9a8c81ba6b4a97483e8f097f9e5dde4253515f05c8e0a89e?d=identicon)[arvinlp](/maintainers/arvinlp)

---

Top Contributors

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

---

Tags

laravellaravel-packagephp8plugin-managertemplate-managertheme-switcher

### Embed Badge

![Health badge](/badges/viranet-vira-template-plugin-engine/health.svg)

```
[![Health](https://phpackages.com/badges/viranet-vira-template-plugin-engine/health.svg)](https://phpackages.com/packages/viranet-vira-template-plugin-engine)
```

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M2.6k](/packages/craftcms-cms)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[rareloop/lumberjack-core

A powerful MVC framework for the modern WordPress developer. Write better, more expressive and easier to maintain code

42155.0k19](/packages/rareloop-lumberjack-core)[codeat3/blade-phosphor-icons

A package to easily make use of "Phosphor Icons" in your Laravel Blade views.

43798.5k21](/packages/codeat3-blade-phosphor-icons)[stijnvanouplines/blade-country-flags

A package to easily make use of country flags in your Laravel Blade views.

26307.2k6](/packages/stijnvanouplines-blade-country-flags)[ublabs/blade-simple-icons

A package to easily make use of Simple Icons in your Laravel Blade views.

1951.2k](/packages/ublabs-blade-simple-icons)

PHPackages © 2026

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