PHP code example of iflow / container
1. Go to this page and download the library: Download iflow/container 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/ */
iflow / container example snippets
use iflow\Container\Container;
$container = Container::getInstance();
// 新建对象
$container -> make('class', ...$args, call: function ($object) { return $object });
// 将已实例化的对象写入容器
$container -> register('class', $obj);
// 获取容器对象
$container -> get('class');
// 验证当前容器是否存在改对象
$container -> has('class');
// 删除容器内对象
$container -> delete('class');