PHP Classes

File: teste.php

Recommend this page to a friend!
  Classes of Thiago Luiz Alves   PHP Dependency Injector   teste.php   Download  
File: teste.php
Role: Example script
Content type: text/plain
Description: Teste Script
Class: PHP Dependency Injector
Container to inject dependencies between classes
Author: By
Last change:
Date: 9 years ago
Size: 436 bytes


Class file image Download

require_once './autoload.php';

$injector = new \App\Core\IoC\Injector();

//Adding a factory class SingletonObject class which implements a singleton pattern provinding always the same instance
$injector->addFactory('\App\Factory\SingletonObject', new \App\Factory\SingletonObjectFactory());

$instance = $injector->getClassInstance('\App\Service\CompanyService');