morphable/simple-container 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

morphable/simple-container

Composer 安装命令:

composer require morphable/simple-container

包简介

A simple container component, easy to implement into any system

README 文档

README

A simple container component, easy to implement into any system

Installing

$ composer require morphable/simple-container

Usage

<?php

use \Morphable\SimpleContainer;

$container = new SimpleContainer();
$container->add('item', new MyClass());
$container->get('item');
$container->exists('item');
$container->update('item', 'something else');
$container->delete('item');

// if you don't know whether the item exists, every method except exists throws an exception

try {
    $container->get('item that does not exists');
} catch (\Morphable\SimpleContainer\Exception\InstanceNotFound $e) {
    // handle exception
}

try {
    $container->add('item that exists', '...');
} catch (\Morphable\SimpleContainer\Exception\InstanceAlreadyExists $e) {
    // handle exception
}

Executable container

<?php

use \Morphable\SimpleContainer\ExecutableContainer;

$container = new ExecutableContainer("required_method");

// needs method required_method
$class = new MyClass();

$container->add('item', $class);

// executes all items in container
$container->execute('any','parameter');

Contributing

  • Follow PSR-2 and the .editorconfig
  • Start namespaces with \Morphable\SimpleContainer
  • Make tests

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固