定制 dakujem/sleeve 二次开发

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

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

dakujem/sleeve

Composer 安装命令:

composer require dakujem/sleeve

包简介

Lightweight PSR-11 service container 📦. A trivial extension of Symfony Pimple container.

README 文档

README

PHP from Packagist Coverage Status Nature Friendly

A lightweight PSR-11 service container.
A trivial extension of Symfony Pimple container.

💿 composer require dakujem/sleeve

Sleeve...

  • is dead simple
  • is PSR-11 compatible
  • extends Pimple (pimple/pimple), a simple Dependency Injection Container by Symfony
  • only adds a couple of convenience methods (accessors) on top of the original
  • works well with Slim v4 and other micro frameworks and stacks

Usage

Added on top of Pimple:

  • methods get, set, has, unset
  • magic accessors __get, __set, __isset, __unset

Examples:

$dic = new Dakujem\Sleeve;

// the following are equivalent
$service = $dic->get('service');    // getter
$service = $dic['service'];         // array accessor
$service = $dic->service;           // magic accessor

// it works for setting services as well
$factory = function(Container $dic) {
               return new Acme\MyService($dic->get('dependency'));
           };
$dic->set('service', $factory);     // setter
$dic['service'] = $factory;         // array accessor
$dic->service = $factory;           // magic accessor

Sleeve supports (through Pimple):

  • singleton services (global)
  • factory services (factories)
  • parameters (with protection too)
  • extensions (service providers)

📖 For full documentation, read the Pimple container usage documentation. It's quite short, in fact.

Testing

composer test

Tested for PHP versions 7.1 onwards.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unlicense
  • 更新时间: 2019-11-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固