mattferris/component

An application component interface

1.0 2017-01-05 21:08 UTC

This package is auto-updated.

Last update: 2024-04-29 03:50:28 UTC


README

composer require mattferris/component

Defines a standard interface for application components. It is used primarily by mattferris/application to define application components for bootloading.

namespace My\Namespace;

use MattFerris\ComponentInterface;

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

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

Components may define constructors to gather any hard dependencies. init() should prepare component resources, while load() should complete any final tasks to make the component live.