catfishphp/container

轻量级依赖注入容器

dev-master 2021-09-02 20:37 UTC

This package is not auto-updated.

Last update: 2024-09-20 20:36:37 UTC


README

Logo

Software License Build Status

此软件包符合PSR-1PSR-2PSR-4规范。如果您发现规范上的疏忽,请通过pull request发送补丁。

安装

通过Composer

$ composer require catfishphp/container

要求

此版本支持以下PHP版本。

  • PHP 7.1
  • PHP 7.2

使用方法

<?php

$container = new Catfish\Container\Container;

// add a service to the container
$container->add('service', 'Acme\Service\SomeService');

// retrieve the service from the container
$service = $container->get('service');

var_dump($service instanceof Acme\Service\SomeService); // true

测试

$ vendor/bin/phpunit

贡献

请参阅CONTRIBUTING以获取详细信息。

许可证

MIT许可证(MIT)。请参阅许可证文件以获取更多信息。