{"id":22814166,"url":"https://github.com/vira-ecosystem/vira-template-plugin-engine","last_synced_at":"2026-02-02T23:08:34.298Z","repository":{"id":266625202,"uuid":"898878287","full_name":"Vira-Ecosystem/vira-template-plugin-engine","owner":"Vira-Ecosystem","description":"This project provides a Template and Plugin Manager for Laravel that allows you to easily manage and integrate templates and plugins.","archived":false,"fork":false,"pushed_at":"2024-12-05T09:34:47.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T13:39:33.271Z","etag":null,"topics":["laravel","laravel-package","php8","plugin-manager","template-manager","theme-switcher"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vira-Ecosystem.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-05T07:55:38.000Z","updated_at":"2024-12-05T09:40:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"4715c9f4-ac4d-4e34-8492-0f393e16c2e9","html_url":"https://github.com/Vira-Ecosystem/vira-template-plugin-engine","commit_stats":null,"previous_names":["arvinlp/vira-template-plugin-engine","vira-ecosystem/vira-template-plugin-engine"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vira-Ecosystem%2Fvira-template-plugin-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vira-Ecosystem%2Fvira-template-plugin-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vira-Ecosystem%2Fvira-template-plugin-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vira-Ecosystem%2Fvira-template-plugin-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vira-Ecosystem","download_url":"https://codeload.github.com/Vira-Ecosystem/vira-template-plugin-engine/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248795148,"owners_count":21162719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-package","php8","plugin-manager","template-manager","theme-switcher"],"created_at":"2024-12-12T13:07:25.239Z","updated_at":"2026-02-02T23:08:29.227Z","avatar_url":"https://github.com/Vira-Ecosystem.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vira Template \u0026 Plugin Manager for Laravel\n\nThis 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.\n\n## Features\n\n- Install, activate, deactivate, and delete templates and plugins.\n- Check for updates and download the latest versions of templates and plugins.\n- Metadata support for templates and plugins (preview image, version description, download link).\n- Load routes and custom pages for plugins and templates dynamically.\n- License validation for plugins.\n- Search functionality for templates and plugins via a web service.\n- Admin Panel Integration: View metadata, install, activate, deactivate, and delete templates and plugins directly from the admin interface.\n\n## Requirements\n\n- PHP \u003e= 7.4\n- Laravel \u003e= 8.0\n- Composer\n\n## Installation\n\n1. **Install via Composer**:\n\n   Add the package to your Laravel project using Composer:\n   \n   ```bash\n   composer require composer require viranet/vira-template-plugin-engine\n   ```\n\n2. **Publish Configuration**:\n\n   Publish the configuration file to your `config` directory:\n   \n   ```bash\n   php artisan vendor:publish --provider=\"ViraNet\\TemplatePluginManager\\ServiceProvider\"\n   ```\n\n   This will create the `config/viranet-tp-engine.php` configuration file where you can adjust the paths, license API URL, and search API URL.\n\n3. **Set Up Directories**:\n\n   Make sure the `public/vira-tp/templates/` and `public/vira-tp/plugins/` directories exist in your project. If they don't, create them:\n   \n   ```bash\n   mkdir -p public/vira-tp/templates\n   mkdir -p public/vira-tp/plugins\n   ```\n\n## Configuration\n\nThe configuration file (`config/viranet-tp-engine.php`) contains the following settings:\n\n```php\nreturn [\n    'template_path' =\u003e storage_path('public/vira-tp/templates/'),\n    'plugin_path' =\u003e storage_path('public/vira-tp/plugins/'),\n    'license_api_url' =\u003e env('LICENSE_API_URL', 'https://license-server.com/api/validate'),\n    'search_api_url' =\u003e env('SEARCH_API_URL', 'https://search-server.com/api/search'),\n];\n```\n\n### .env\n\nEnsure the following environment variables are set in your `.env` file:\n\n```env\nLICENSE_API_URL=https://license-server.com/api/validate\nSEARCH_API_URL=https://search-server.com/api/search\n```\n\n## Admin Panel Integration\n\n### Displaying Metadata in Admin Panel\n\nYou can integrate the Template \u0026 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.\n\n#### Example: Fetching and Displaying Metadata\n\nIn your admin panel controller, you can fetch and display metadata as follows:\n\n```php\nuse YourNamespace\\TemplatePluginManager\\TemplateManager;\nuse YourNamespace\\TemplatePluginManager\\PluginManager;\n\nclass AdminController extends Controller\n{\n    protected $templateManager;\n    protected $pluginManager;\n\n    public function __construct(TemplateManager $templateManager, PluginManager $pluginManager)\n    {\n        $this-\u003etemplateManager = $templateManager;\n        $this-\u003epluginManager = $pluginManager;\n    }\n\n    // Show the templates in the admin panel\n    public function showTemplates()\n    {\n        $templates = $this-\u003egetAllTemplates();\n        return view('admin.templates.index', compact('templates'));\n    }\n\n    // Show the plugins in the admin panel\n    public function showPlugins()\n    {\n        $plugins = $this-\u003egetAllPlugins();\n        return view('admin.plugins.index', compact('plugins'));\n    }\n\n    private function getAllTemplates()\n    {\n        $templates = [];\n        $templateDirs = glob(storage_path('public/vira-tp/templates/*'), GLOB_ONLYDIR);\n\n        foreach ($templateDirs as $templateDir) {\n            $templateName = basename($templateDir);\n            $metadata = $this-\u003etemplateManager-\u003egetTemplateMetadata($templateName);\n            if ($metadata) {\n                $templates[] = $metadata;\n            }\n        }\n\n        return $templates;\n    }\n\n    private function getAllPlugins()\n    {\n        $plugins = [];\n        $pluginDirs = glob(storage_path('public/vira-tp/plugins/*'), GLOB_ONLYDIR);\n\n        foreach ($pluginDirs as $pluginDir) {\n            $pluginName = basename($pluginDir);\n            $metadata = $this-\u003epluginManager-\u003egetPluginMetadata($pluginName);\n            if ($metadata) {\n                $plugins[] = $metadata;\n            }\n        }\n\n        return $plugins;\n    }\n}\n```\n\nIn 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.\n\n#### Example View for Templates (`resources/views/admin/templates/index.blade.php`)\n\n```blade\n@extends('layouts.admin')\n\n@section('content')\n    \u003ch1\u003eTemplates\u003c/h1\u003e\n    \u003ctable\u003e\n        \u003cthead\u003e\n            \u003ctr\u003e\n                \u003cth\u003eName\u003c/th\u003e\n                \u003cth\u003eDescription\u003c/th\u003e\n                \u003cth\u003eVersion\u003c/th\u003e\n                \u003cth\u003ePreview\u003c/th\u003e\n                \u003cth\u003eActions\u003c/th\u003e\n            \u003c/tr\u003e\n        \u003c/thead\u003e\n        \u003ctbody\u003e\n            @foreach($templates as $template)\n                \u003ctr\u003e\n                    \u003ctd\u003e{{ $template['name'] }}\u003c/td\u003e\n                    \u003ctd\u003e{{ $template['description'] }}\u003c/td\u003e\n                    \u003ctd\u003e{{ $template['version'] }}\u003c/td\u003e\n                    \u003ctd\u003e\u003cimg src=\"{{ $template['preview_image'] }}\" alt=\"{{ $template['name'] }}\" width=\"50\"\u003e\u003c/td\u003e\n                    \u003ctd\u003e\n                        \u003c!-- Add your action buttons here --\u003e\n                        \u003cform action=\"{{ route('admin.templates.activate', $template['name']) }}\" method=\"POST\"\u003e\n                            @csrf\n                            \u003cbutton type=\"submit\"\u003eActivate\u003c/button\u003e\n                        \u003c/form\u003e\n                    \u003c/td\u003e\n                \u003c/tr\u003e\n            @endforeach\n        \u003c/tbody\u003e\n    \u003c/table\u003e\n@endsection\n```\n\nThis 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.\n\n### Admin Panel Routes\n\nYou can define routes for the admin panel to manage templates and plugins:\n\n```php\n// routes/web.php\n\nuse App\\Http\\Controllers\\AdminController;\n\nRoute::prefix('admin')-\u003ename('admin.')-\u003emiddleware(['auth', 'admin'])-\u003egroup(function () {\n    Route::get('templates', [AdminController::class, 'showTemplates'])-\u003ename('templates.index');\n    Route::get('plugins', [AdminController::class, 'showPlugins'])-\u003ename('plugins.index');\n    Route::post('templates/activate/{template}', [AdminController::class, 'activateTemplate'])-\u003ename('templates.activate');\n    Route::post('plugins/activate/{plugin}', [AdminController::class, 'activatePlugin'])-\u003ename('plugins.activate');\n});\n```\n\nThese routes handle the display and management of templates and plugins in your admin panel.\n\n## Routes\n\nWhen 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.\n\n#### Example of a Plugin Route File (`routes/web.php`)\n\n```php\n// Inside your plugin's routes/web.php\n\nRoute::get('/my-plugin', function () {\n    return view('my-plugin::home');\n});\n```\n\n## Metadata Format\n\nEach 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.\n\n#### Example `metadata.json` for a Plugin\n\n```json\n{\n    \"name\": \"My Plugin\",\n    \"version\": \"1.0.0\",\n    \"description\": \"This is a powerful plugin for Laravel.\",\n    \"preview_image\": \"https://example.com/plugin-preview.jpg\",\n    \"download_url\": \"https://example.com/download/my-plugin.zip\",\n    \"latest_version\": \"1.1.0\"\n}\n```\n\n#### Example `metadata.json` for a Template\n\n```json\n{\n    \"name\": \"My Template\",\n    \"version\": \"1.0.0\",\n    \"description\": \"A beautiful template for your Laravel application.\",\n    \"preview_image\": \"https://example.com/template-preview.jpg\",\n    \"download_url\": \"https://example.com/download/my-template.zip\",\n    \"latest_version\": \"1.1.0\"\n}\n```\n\n## License\n\nThis package is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n\n## \nHelp to improve the package :D","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvira-ecosystem%2Fvira-template-plugin-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvira-ecosystem%2Fvira-template-plugin-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvira-ecosystem%2Fvira-template-plugin-engine/lists"}