承接 phpfox/container 相关项目开发

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

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

phpfox/container

最新稳定版本:0.3.0

Composer 安装命令:

composer require phpfox/container

包简介

A simple DI container for the PHPFox framework

README 文档

README

GitHub release (latest by date) tests Total Downloads GitHub

This is the repository for the DI Container used in the PHP-Fox framework.

Installation

You should not need to install this package when using the PHP-Fox framework, however if you wish to use this outside of the framework please use:

composer require phpfox/container

Usage

To use the container, all you need to do is:

$container = Container::getInstance();

$container->bind(
    abstract: Abstract::class,
    concrete: Concrete::class,
    shared: false, // defaults to false - true turns this into a singleton.
);

/**
 * @var bool
 */
$exists = $container->has(
    id: Abstract::class,
);

/**
 * @var Concrete
 */
$concrete = $container->make(
    abstract: Abstract::class,
);

Container implementation inspired by example repo from Jess Archer, which provides a great and simple base.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-06-17