PHP code example of huid / container
1. Go to this page and download the library: Download huid/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/ */
huid / container example snippets
use Huid\Application;
$application = new Application
$application->bind('hello', function () {
return 'hello world';
});
echo $application->hello();
# 定义如下 `plugin` 文件
class Huid\Application\plugins;
class HelloWorld implements PluginContract
{
public static function install(Application $application, ...$opt)
{
$application->bind('hello', function () {
return 'hello world plugin';
});
}
}
# 运行
use Huid\Application;
use Huid\Application\Plugins\HelloWorldPlugin;
$application = new Application
$application->use(HelloWorldPlugin::class);
echo $application->hello();