carlosocarvalho/coci 问题修复 & 功能扩展

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

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

carlosocarvalho/coci

最新稳定版本:1.0.0

Composer 安装命令:

composer require carlosocarvalho/coci

包简介

php simple injection

README 文档

README

PHP Simple Injection, use classe in project.

Build Status Latest Stable Version Total Downloads Latest Unstable Version License

##Install Composer install

  {
     "require":"carlosocarvalho/coci": "1.0.0"
  }

##Example use

<?php
  
  require "vendor/autoload.php";
  
  use COC\COCI\Injection;
  $inj = new Injection;

Create Classes Injections with Agregration (Person)

  Class Person(){
     private $person ;
    class function __construct(TypePerson $typePerson){
           $this->person = $typePerson;
     }   
  
  }

Create Classes Injections(TypePerson)

  <?php    
  Class TypePerson(){
    private $type;
    setType($type){
      $this->type;
    }
    getType(){
      return $this->type;
    }
  }

Inject Classes Closure

 <?php 
   $inj->set('TypePerson',function(){
      return new TypePerson();
   })
   
  $inj->set('Person',function() use ($inj){
     return new Person($inj->get('TypePerson'));
   });

Inject Classes By Reflection

 <?php 
   
   $inj->get('TypePerson');

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL
  • 更新时间: 2015-05-27