定制 apinephp/container 二次开发

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

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

apinephp/container

Composer 安装命令:

composer require apinephp/container

包简介

A minimalistic PSR-11 Dependency Container

README 文档

README

A minimalistic PSR-11 DI and IoC Container

Installation

Installation is made with composer

composer require apinephp/container

The package requires PHP 7.4 or newer.

Usage Example

<?php
    
use Apine\Container\Container;

$container = new Container();
$container->register('service', function () {
    return 'A service';
});

$container->get('service'); // 'A service'

DI with services

Instantiate new services using the createInstance function. It produces a Closure that will create an instance of the class applying dependency resolution and injection against the services in the container.

<?php
    
use Apine\Container\Container;
use function Apine\Container\createInstance;

$container = new Container();
$container->register('service', createInstance(StubClass::class));

$service = $container->get('service'); // Returns an instance of StubClass

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固