定制 power-modules/plugin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

power-modules/plugin

最新稳定版本:v1.0.0

Composer 安装命令:

composer require power-modules/plugin

包简介

A modular plugin component for the Power Modules framework, enabling seamless integration and extension of functionalities.

README 文档

README

CI Packagist Version PHP Version License: MIT PHPStan

A plugin architecture library for the Power Modules framework that uses PHPDoc generics for IDE/PHPStan type safety, enabling extensible plugin systems with automatic discovery, dependency injection, and seamless integration.

🔌 Extensible: Designed for applications that need third-party extensions, dynamic feature loading, or modular plugin architectures.

✨ Architectural Vision

The Plugin System Extension is not just an add-on; it's a foundational library that brings a new level of type safety and developer experience to building extensible PHP applications. It is built on the principle that plugins should be first-class citizens in the application architecture, with full access to dependency injection and module encapsulation.

Our goal is to provide a system that is both powerful and easy to use, enabling developers to create complex plugin-based systems with confidence.

🚀 Quick Start

composer require power-modules/plugin

Define a plugin, provide it from a module, and the framework handles the rest.

use Modular\Framework\Container\ConfigurableContainerInterface;
use Modular\Framework\PowerModule\Contract\PowerModule;
use Modular\Plugin\Contract\Plugin;
use Modular\Plugin\Contract\PluginRegistry;
use Modular\Plugin\Contract\ProvidesPlugins;
use Modular\Plugin\PluginMetadata;

// 1. Define a plugin
final class MyPlugin implements Plugin
{
    public static function getPluginMetadata(): PluginMetadata
    {
        return new PluginMetadata('My Plugin', '1.0.0', 'Example plugin');
    }
}

// 2. Provide it from a module
final class MyModule implements PowerModule, ProvidesPlugins
{
    public static function getPlugins(): array
    {
        return [PluginRegistry::class => [MyPlugin::class]];
    }

    public function register(ConfigurableContainerInterface $container): void
    {
        $container->set(MyPlugin::class, MyPlugin::class);
    }
}

// 3. The application automatically discovers and registers it
$app = (new ModularAppBuilder(__DIR__))
    ->withPowerSetup(...PluginRegistrySetup::withDefaults())
    ->withModules(MyModule::class)
    ->build();

// 4. Use it
/** @var PluginRegistry<MyPlugin> $registry */
$registry = $app->get(PluginRegistry::class);
$plugin = $registry->makePlugin(MyPlugin::class);

📚 Documentation

📖 Complete Documentation Hub - Comprehensive guides, examples, and API reference.

Quick Links:

🌟 Key Features

  • Enhanced Developer Experience: Generic annotations provide better IDE support and static analysis.
  • Automatic Discovery: PluginRegistrySetup scans modules implementing ProvidesPlugins and registers declared plugin classes.
  • Lazy Loading: Plugins are instantiated only when requested through registries.
  • Container Integration: Full dependency injection support for plugins.
  • Multiple Registries: Support for specialized plugin types with custom registries.
  • Framework Native: Built specifically for the Power Modules architecture.

Contributing

See CONTRIBUTING.md for development setup and guidelines.

License

MIT License. See LICENSE for details.

The Plugin System Extension enables your Power Modules application to support rich plugin architectures with type safety, automatic discovery, and full dependency injection support.

统计信息

  • 总下载量: 41
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固