2017 © Pedro Peláez
 

library coci

php simple injection

image

carlosocarvalho/coci

php simple injection

  • Thursday, September 17, 2015
  • by carlosocarvalho
  • Repository
  • 1 Watchers
  • 1 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

COCI

PHP Simple Injection, use classe in project., (*1)

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

Install

Composer install, (*3)

  {
     "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), (*4)

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

  }

Create Classes Injections(TypePerson), (*5)

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

Inject Classes Closure, (*6)

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

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

Inject Classes By Reflection, (*7)

 <?php 

   $inj->get('TypePerson');

The Versions

17/09 2015

dev-master

9999999-dev

php simple injection

  Sources   Download

GPL

The Requires

  • php >= 5.4

 

by Carlos Carvalho

28/05 2015

1.0.0

1.0.0.0

php simple injection

  Sources   Download

GPL

The Requires

  • php >= 5.4

 

by Carlos Carvalho