承接 a50/container-php-di 相关项目开发

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

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

a50/container-php-di

Composer 安装命令:

composer require a50/container-php-di

包简介

A50 Container

README 文档

README

A50 Container


This package provides a factory for PSR-11 compatible dependency injection container that is able to instantiate and configure classes resolving dependencies and ServiceProvider interface.

Uses PHP-DI as a core.

Latest Version on Packagist Tests Analysis Total Downloads

Installation

You can install the package via composer:

composer require a50/container

Usage

To create a container you need to pass array of ServiceProvider objects interface:

<?php

declare(strict_types=1);

use Psr\Container\ContainerInterface;
use A50\Container\ContainerFactory;
use A50\Container\ServiceProvider;

$container = ContainerFactory::build([
    new class implements ServiceProvider {
        /**
         * @inheritDoc
         */
        public static function getDefinitions(): array
        {
            return [
                stdClass::class => static fn() => new stdClass(),
            ];
        }

        /**
         * @inheritDoc
         */
        public static function getExtensions(): array
        {
            return [
                stdClass::class => static function ($stdClass, ContainerInterface $container): stdClass {
                    $stdClass->property = 'value';

                    return $stdClass;
                }
            ];
        }
    }
]);

Testing

make test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-12-07