echo-fusion/pluginmanager
Composer 安装命令:
composer require echo-fusion/pluginmanager
包简介
A flexible PHP package for managing and integrating plugins, allowing dynamic loading and registration based on application environments. Enhance the modularity and extensibility of your applications with ease.
关键字:
README 文档
README
The PluginManager is a versatile package for managing and integrating plugins into your PHP applications. It allows you to dynamically load and register plugins based on the environment, making your application modular and extensible.
Installation
Install the package via Composer:
composer require echo-fusion/pluginmanager
Requirements
The following versions of PHP are supported by this version.
- PHP 8.1
- PHP 8.2
- PHP 8.3
Usage
Here’s how to use the PluginManager to set up and run:
- Instantiate the PluginManager with an array of plugins, specifying the environments in which they should be loaded:
use EchoFusion\PluginManager\PluginManager; use Psr\Container\ContainerInterface; $createPluginManager = function(ContainerInterface $container) { $plugins = [ MyPlugin::class, AnotherPlugin::class, ]; return new PluginManager($container, $plugins); }
- Register the plugins based on the current environment:
// Usage $container = // Your container implementation here $pluginManager = $createPluginManager($container); try { // Register plugins for a specific environment (e.g., 'dev') $pluginManager->register('dev'); } catch (PluginManagerException $e) { // Handle any exceptions related to plugin management echo 'Error registering plugins: ' . $e->getMessage(); } catch (Throwable $e) { // General fallback for other types of exceptions echo 'An unexpected error occurred: ' . $e->getMessage(); }
- Ensure that your plugins implement the PluginInterface:
<?php declare(strict_types=1); namespace YourNamespace\Plugins; use EchoFusion\PluginManager\PluginInterface; use EchoFusion\PluginManager\Environment; class ExamplePlugin implements PluginInterface { private $service; public function register(): void { // Initialize the service $this->service = $this->initializeService(); // Set up configurations $this->configureSettings(); // Register event listeners $this->registerEventListeners(); echo "ExamplePlugin has been registered successfully.\n"; } public function getSupportedEnvironments(): array { return ['dev','prod']; } //... }
Testing
Testing includes PHPUnit and PHPStan (Level 7).
$ composer test
Credits
Developed and maintained by Amir Shadanfar.
Connect on LinkedIn.
License
The MIT License (MIT). Please see License File for more information.
echo-fusion/pluginmanager 适用场景与选型建议
echo-fusion/pluginmanager 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 10 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「Plugin Manager」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 echo-fusion/pluginmanager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 echo-fusion/pluginmanager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 echo-fusion/pluginmanager 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
KCFinder web file manager
Publish / Subscribe / Event Manager
Plugin for YOURLS. Default tools to use in some laemmi plugins
AclManager plugin for CakePHP 3.x
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 27
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-17