laravilt/plugins

Complete plugin system with generator, management, and FilamentPHP compatibility for Laravilt

Fund package maintenance!
fadymondy

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

pkg:composer/laravilt/plugins

1.0.0 2025-12-02 13:21 UTC

This package is auto-updated.

Last update: 2025-12-02 13:22:11 UTC


README

Screenshot

Laravilt Plugins

Latest Stable Version License Downloads Dependabot Updates PHP Code Styling Tests

Complete plugin system with generator, management, and FilamentPHP v4 compatibility for Laravilt.ipsum

โœจ Features

๐ŸŽจ Plugin Generation

  • Interactive CLI - Laravel Prompts with smart defaults
  • Factory Pattern - Extensible feature-based architecture
  • Priority System - Ordered feature execution (0-100)
  • Stub Processing - Template-based file generation
  • Auto-Discovery - Automatic plugin registration

๐Ÿงฉ Component Generators

Generate 13 component types within plugins:

  • Migration - Database migrations with timestamps
  • Model - Eloquent models with proper namespacing
  • Controller - HTTP controllers
  • Command - Artisan commands
  • Job - Queueable jobs
  • Event - Event classes
  • Listener - Event listeners
  • Notification - Notifications with mail support
  • Seeder - Database seeders
  • Factory - Model factories
  • Test - Feature/Unit tests
  • Lang - Language files
  • Route - Route files

๐Ÿค– MCP Server Integration

  • AI Agent Support - Built-in MCP server for Claude, GPT, etc.
  • 6 Tools Available - list-plugins, plugin-info, generate-plugin, generate-component, list-component-types, plugin-structure
  • Natural Language - Generate plugins through conversation
  • Auto-Discovery - AI agents can explore plugin ecosystem

๐ŸŽจ Professional Assets

  • Cover Images - Auto-generated 1200x630px screenshots
  • Dark Theme - Professional gradient backgrounds
  • Plugin Branding - Cyan icon with Laravilt branding
  • Social Media Ready - Optimized for GitHub/Twitter previews
  • README Integration - Auto-embedded in documentation

โš™๏ธ GitHub Integration

  • Workflows - tests.yml, fix-php-code-styling.yml, dependabot-auto-merge.yml
  • Issue Templates - Bug reports, feature requests (GitHub forms)
  • Dependabot - Automated dependency updates
  • FUNDING.yml - GitHub Sponsors support
  • CONTRIBUTING.md - Contribution guidelines
  • SECURITY.md - Security vulnerability reporting

๐Ÿ“ฆ Complete Package Setup

  • Service Provider - Auto-discovery compatible
  • Configuration - Publishable config with env support
  • Composer - PSR-4 autoloading, version constraints
  • Testing - Pest, PHPStan, Pint, Testbench
  • Assets - Vite, Tailwind v4, Vue.js plugin support
  • Documentation - README, CHANGELOG, LICENSE, CODE_OF_CONDUCT

๐Ÿ“‹ Requirements

  • PHP 8.3+
  • Laravel 12+
  • FilamentPHP v4+ (for plugins features)
  • Composer 2+
  • Node.js 18+ (for asset compilation)

๐Ÿš€ Installation

composer require laravilt/plugins

The service provider is auto-discovered and will register automatically.

Configuration

Publish the configuration file:

php artisan vendor:publish --tag=laravilt-plugins-config

Configure defaults in config/laravilt-plugins.php:

return [
    'defaults' => [
        'vendor' => env('LARAVILT_PLUGINS_DEFAULT_VENDOR', 'laravilt'),
        'author' => env('LARAVILT_PLUGINS_DEFAULT_AUTHOR', 'Your Name'),
        'email' => env('LARAVILT_PLUGINS_DEFAULT_EMAIL', 'your@email.com'),
        'license' => env('LARAVILT_PLUGINS_DEFAULT_LICENSE', 'MIT'),
        'github_sponsor' => env('LARAVILT_PLUGINS_DEFAULT_GITHUB_SPONSOR', 'yourusername'),
    ],
];

MCP Server Setup (for AI Agents)

Install the MCP server configuration:

php artisan laravilt:install-mcp

This command will:

  • Publish routes/ai.php (if needed)
  • Register the MCP server in your routes
  • Update .mcp.json for AI clients

After installation, restart your AI agent to access the plugin management tools.

๐Ÿ“– Usage

Generate a Plugin

Interactive mode (recommended):

php artisan laravilt:plugin MyPlugin

Non-interactive mode:

php artisan laravilt:plugin MyPlugin --no-interaction

The command will guide you through:

  1. Plugin name and description
  2. Feature selection (migrations, views, routes, assets, etc.)
  3. Author details (optional)
  4. GitHub sponsor (optional)
  5. Language selection

Generate Components

Use the unified component generator:

php artisan laravilt:make

Or specify directly:

# Generate a model
php artisan laravilt:make my-plugin model Post

# Generate a controller
php artisan laravilt:make my-plugin controller PostController

# Generate a migration
php artisan laravilt:make my-plugin migration CreatePostsTable

# Generate a command
php artisan laravilt:make my-plugin command ProcessPostsCommand

# Generate a job
php artisan laravilt:make my-plugin job ProcessPost

# Generate a test
php artisan laravilt:make my-plugin test PostTest

All 13 component types are supported with proper namespace detection and PSR-4 structure.

Generated Plugin Structure

my-plugin/
โ”œโ”€โ”€ .github/
โ”‚   โ”œโ”€โ”€ workflows/
โ”‚   โ”‚   โ”œโ”€โ”€ tests.yml
โ”‚   โ”‚   โ”œโ”€โ”€ fix-php-code-styling.yml
โ”‚   โ”‚   โ””โ”€โ”€ dependabot-auto-merge.yml
โ”‚   โ”œโ”€โ”€ ISSUE_TEMPLATE/
โ”‚   โ”‚   โ”œโ”€โ”€ bug.yml
โ”‚   โ”‚   โ””โ”€โ”€ config.yml
โ”‚   โ”œโ”€โ”€ CONTRIBUTING.md
โ”‚   โ”œโ”€โ”€ FUNDING.yml
โ”‚   โ”œโ”€โ”€ SECURITY.md
โ”‚   โ””โ”€โ”€ dependabot.yml
โ”œโ”€โ”€ arts/
โ”‚   โ””โ”€โ”€ screenshot.jpg                    # Auto-generated cover image
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ laravilt-my-plugin.php
โ”œโ”€โ”€ database/
โ”‚   โ”œโ”€โ”€ factories/
โ”‚   โ”œโ”€โ”€ migrations/
โ”‚   โ””โ”€โ”€ seeders/
โ”œโ”€โ”€ resources/
โ”‚   โ”œโ”€โ”€ css/
โ”‚   โ”‚   โ””โ”€โ”€ app.css                       # Tailwind v4
โ”‚   โ”œโ”€โ”€ js/
โ”‚   โ”‚   โ””โ”€โ”€ app.js                        # Vue.js plugin
โ”‚   โ”œโ”€โ”€ lang/
โ”‚   โ”‚   โ””โ”€โ”€ en/
โ”‚   โ””โ”€โ”€ views/
โ”œโ”€โ”€ routes/
โ”‚   โ”œโ”€โ”€ api.php
โ”‚   โ””โ”€โ”€ web.php
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ Commands/
โ”‚   โ”‚   โ””โ”€โ”€ InstallMyPluginCommand.php
โ”‚   โ”œโ”€โ”€ Http/
โ”‚   โ”‚   โ””โ”€โ”€ Controllers/
โ”‚   โ”œโ”€โ”€ Models/
โ”‚   โ”œโ”€โ”€ MyPluginPlugin.php                # Main plugin class
โ”‚   โ””โ”€โ”€ MyPluginServiceProvider.php
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ Feature/
โ”‚   โ”‚   โ””โ”€โ”€ DebugTest.php
โ”‚   โ”œโ”€โ”€ Pest.php
โ”‚   โ””โ”€โ”€ TestCase.php
โ”œโ”€โ”€ CHANGELOG.md
โ”œโ”€โ”€ CODE_OF_CONDUCT.md
โ”œโ”€โ”€ LICENSE.md
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ composer.json
โ”œโ”€โ”€ package.json                          # If JS selected
โ”œโ”€โ”€ phpstan.neon
โ”œโ”€โ”€ pint.json
โ”œโ”€โ”€ testbench.yaml
โ””โ”€โ”€ vite.plugin.js                        # If JS selected

๐Ÿ—๏ธ Architecture

Factory Pattern

The plugin system uses a Factory Pattern for extensible feature generation:

Features (Priority 0-100)
โ”œโ”€โ”€ Core Files (0-20)
โ”‚   โ”œโ”€โ”€ ComposerJsonFeature (1)
โ”‚   โ”œโ”€โ”€ GitignoreFeature (2)
โ”‚   โ”œโ”€โ”€ ServiceProviderFeature (5)
โ”‚   โ”œโ”€โ”€ PluginClassFeature (10)
โ”‚   โ”œโ”€โ”€ InstallCommandFeature (12)
โ”‚   โ””โ”€โ”€ ConfigFeature (15)
โ”œโ”€โ”€ Structure Files (21-40)
โ”‚   โ”œโ”€โ”€ MigrationsFeature (25)
โ”‚   โ”œโ”€โ”€ RoutesFeature (30)
โ”‚   โ”œโ”€โ”€ ViewsFeature (35)
โ”‚   โ””โ”€โ”€ LanguageFeature (40)
โ”œโ”€โ”€ Asset Files (41-60)
โ”‚   โ”œโ”€โ”€ CssFeature (50)
โ”‚   โ”œโ”€โ”€ JsFeature (51)
โ”‚   โ””โ”€โ”€ ArtsFeature (55)
โ”œโ”€โ”€ Testing Files (61-80)
โ”‚   โ”œโ”€โ”€ TestingFeature (70)
โ”‚   โ”œโ”€โ”€ TestbenchFeature (75)
โ”‚   โ””โ”€โ”€ PintFeature (76)
โ””โ”€โ”€ Documentation Files (81-100)
    โ”œโ”€โ”€ ReadmeFeature (85)
    โ”œโ”€โ”€ GitHubFeature (90)
    โ””โ”€โ”€ DocumentationFeature (95)

Extending with Custom Features

Create a custom feature:

<?php

namespace App\PluginFeatures;

use Laravilt\Plugins\Features\AbstractFeature;

class CustomFeature extends AbstractFeature
{
    public function getName(): string
    {
        return 'custom';
    }

    public function shouldGenerate(array $config): bool
    {
        return $config['generate_custom'] ?? false;
    }

    public function getPriority(): int
    {
        return 99; // Execute near the end
    }

    public function generate(array $config): void
    {
        // Your generation logic
        $this->processor->generateFile(
            $config['base_path'].'/custom/file.php',
            'custom/file',
            ['key' => 'value']
        );
    }
}

Register in config:

'features' => [
    // ... existing features
    \App\PluginFeatures\CustomFeature::class,
],

๐Ÿค– MCP Server

Available Tools

list-plugins

List all installed Laravilt plugins.

plugin-info

Get detailed information about a specific plugin.

Arguments:

  • plugin (string): Plugin name in kebab-case

generate-plugin

Generate a new plugin with specified features.

Arguments:

  • name (string): Plugin name in StudlyCase
  • description (string, optional)
  • migrations (bool, default: false)
  • views (bool, default: false)
  • webRoutes (bool, default: false)
  • apiRoutes (bool, default: false)
  • css (bool, default: false)
  • js (bool, default: false)
  • arts (bool, default: true)
  • github (bool, default: true)
  • phpstan (bool, default: true)

generate-component

Generate a component within a plugin.

Arguments:

  • plugin (string): Plugin name in kebab-case
  • type (string): Component type (migration, model, controller, etc.)
  • name (string): Component name

list-component-types

List all available component types.

plugin-structure

Get the complete directory structure of a plugin.

Arguments:

  • plugin (string): Plugin name in kebab-case

AI Agent Examples

You: "List all my plugins"
AI: [calls list-plugins tool]

You: "Create a blog plugin with migrations and views"
AI: [calls generate-plugin with appropriate parameters]

You: "Generate a Post model in the blog plugin"
AI: [calls generate-component]

๐Ÿงช Testing

Run tests in the plugins package:

cd packages/laravilt/plugins
composer test

Run tests in a generated plugin:

cd packages/myvendor/my-plugin
composer test          # Run Pest tests
composer format        # Format code with Pint
composer analyse       # Run PHPStan analysis

๐Ÿ“š Documentation

Comprehensive documentation is available in the docs/ directory:

๐Ÿค Contributing

Please see CONTRIBUTING.md for details.

๐Ÿ”’ Security

If you discover any security-related issues, please email info@3x1.io instead of using the issue tracker.

๐Ÿ“ Changelog

Please see CHANGELOG.md for recent changes.

๐Ÿ“„ License

The MIT License (MIT). Please see License File for more information.

๐Ÿ‘ฅ Credits

๐ŸŒŸ Sponsors

Support this project via GitHub Sponsors.