PHP code example of clearswitch / doraemon-ioc
1. Go to this page and download the library: Download clearswitch/doraemon-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/ */
clearswitch / doraemon-ioc example snippets
use Clearswitch\DoraemonIoc\Container;
/**
* 注册服务
* @param1:给绑定服务起的别名
* @param2:具体类的路径,也可以是回掉函数
*/
Container::bind("test","test.php");
/**
* 使用
*/
Container::make("test");
/**
* 当然你也可以直接绑定和是使用放在一起
*/
Container::make("test",'test,php');