1. Go to this page and download the library: Download orakaro/ioc library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
orakaro / ioc example snippets
class Library{
public function overview()
{
$book = Book::getTitle($ISBN);
return $book;
}
}
rakaro\IoC\core\IoC;
class IoCRegister{
public static function registerAll()
{
/* IoC register for Book::getTitle */
IoC::register('Book_getTitle', function($ISBN){
return Book::getTitle($ISBN);
});
}
}
class IoCBook{
public static function getTitle($ISBN)
{
$registedClosure = IoC::resolve('Book_getTitle');
return $registedClosure($ISBN);
}
}
re_once __DIR__ . 'IoCRegister.php';
class Library{
public function overview()
{
$book = IoCBook::getTitle($ISBN);
return $book;
}
}
bash
composer dump-autoload
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.