承接 monkeyscloud/monkeyslegion-contracts 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

monkeyscloud/monkeyslegion-contracts

Composer 安装命令:

composer require monkeyscloud/monkeyslegion-contracts

包简介

Lightweight contracts (interfaces & abstract bases) for the MonkeysLegion framework — zero framework coupling.

README 文档

README

License: MIT

Lightweight contracts (interfaces & abstract base classes) for the MonkeysLegion framework.

This package exists so that external packages and third-party bundles can implement framework contracts (like ServiceProviderInterface) without pulling in the entire monkeyscloud/monkeyslegion meta-package.

Installation

composer require monkeyscloud/monkeyslegion-contracts

Dependencies

Package Version
php ^8.4
psr/container ^2.0

That's it. No framework packages required.

Provided Contracts

ServiceProviderInterface

The contract for modular service providers. Implement this to register DI definitions, specify context (http, cli, all), and hook into the container boot lifecycle.

use MonkeysLegion\Contracts\ServiceProviderInterface;
use Psr\Container\ContainerInterface;

class MyPackageProvider implements ServiceProviderInterface
{
    public function getDefinitions(): array
    {
        return [
            MyService::class => fn() => new MyService(),
        ];
    }

    public function provides(): array
    {
        return [MyService::class];
    }

    public function context(): string
    {
        return 'all';
    }

    public function isDeferred(): bool
    {
        return false;
    }

    public function boot(ContainerInterface $container): void
    {
        // Post-build initialization
    }
}

AbstractServiceProvider

Convenience base class with sensible defaults — only getDefinitions() is required:

use MonkeysLegion\Contracts\AbstractServiceProvider;

class MyPackageProvider extends AbstractServiceProvider
{
    public function getDefinitions(): array
    {
        return [
            MyService::class => fn() => new MyService(),
        ];
    }
}

How It Fits Together

Layer Package What it does
Contract monkeyslegion-contracts Defines ServiceProviderInterface
Framework monkeyslegion Discovers & boots providers via ProviderScanner
Your Package your-vendor/your-package Implements the interface, requires only contracts
App monkeyslegion-skeleton Registers package providers in Bootstrap

External packages require only monkeyslegion-contracts. The consuming application registers them during bootstrap:

Application::create($basePath)
    ->withProviders([YourPackageProvider::class])
    ->run();

License

MIT © MonkeysCloud

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固