2017 © Pedro Peláez
 

liblary tc

A PHP Injection liblary

image

renshan/tc

A PHP Injection liblary

  • Saturday, October 15, 2016
  • by renshan
  • Repository
  • 1 Watchers
  • 2 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

TC

A PHP Injection Liblary., (*1)

Install

composer require renshan/tc

Usage

Define A Service Without Parameter

namespace Foo;

class Foo 
{
    public function foo()
    {
        // Do anything here
    }
}
use Tc\Container;


$container = new Container;

$defKey = 'service.foo';
$defMap = 'Foo\Foo';

$container->register($defKey, $defMap);


Define A Service With Parameters


namespace Bar; use Foo\Foo; class Bar { /** * This class need a parameter whic a instance of Foo, and a parameter $bar */ public function constructor(Foo $foo, $bar) { } public function bar() { // Do anything here } }

and you can define a service like this:, (*2)



$container = new Container; $defKey = 'service.bar'; $defMap = 'Bar\Bar'; $params = ['@service.foo', 'bar']; // Be sure the position of parameters $container->register($defKey, $defMap, $params);

finally, you can use your services now:, (*3)


$foo = $container->get('service.foo'); $bar = $container->get('service.bar');

and you can get a raw service:, (*4)


$contnainer->raw('service.foo');

By default, a service will generate one and only a instance of the map class., (*5)

The Versions

15/10 2016

dev-master

9999999-dev

A PHP Injection liblary

  Sources   Download

MIT

by Avatar renshan

15/10 2016

1.0.0

1.0.0.0

A PHP Injection liblary

  Sources   Download

MIT

by Avatar renshan