mattferris/component

1.0 2017-01-05 21:08 UTC

This package is auto-updated.

Last update: 2024-09-29 04:42:36 UTC


README

composer require mattferris/component

定义应用组件的标准接口。它主要被 mattferris/application 用于定义启动加载的应用组件。

namespace My\Namespace;

use MattFerris\ComponentInterface;

class MyComponent implements ComponentInterface
{
    /**
     * Perform any component intialization tasks
     */
    public function init()
    {
        // ...
    }

    /**
     * Load the component
     */
    public function load()
    {
        // ...
    }
}

组件可以定义构造函数来收集任何硬依赖。 init() 应该准备组件资源,而 load() 应该完成任何最终任务使组件生效。