Skip to content

Merophp/bundle-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

Bundle manager for the merophp framework.

Installation

Via composer:

composer require merophp/bundle-manager

Basic Usage

require_once 'vendor/autoload.php';

use Merophp\BundleManager\BundleManager;

use Merophp\BundleManager\Collection\BundleCollection;
use Merophp\BundleManager\Provider\BundleProvider;
use Merophp\BundleManager\Bundle;

$collection = new BundleCollection();
$collection->addMultiple([
    new Bundle('MyOrganization\\MyBundlename'),
    new Bundle('MyOrganization\\MyBundlename2', ['myconfigKey'=>'myConfigValue']),
]);

$provider = new BundleProvider($collection);
$bundleManager = new BundleManager($provider);

$bundleManager->startRegisteredBundles();

Bundle Bootstrapping

A bundle must have a bootstrapper class which implements Merophp\BundleManager\BundleBootstrapper\BundleBootstrapperInterface. The bootstrapper class name is a compound of the bundle identifier as the namespace prefix and Bootstrapping/Bootstrapper. For the example above the fully qualified bootstrapper class name is MyOrganization\MyBundlename\Bootstrapping\Bootstrapper:


namespace MyOrganization\MyBundlename\Bootstrapping;

use Merophp\BundleManager\BundleBootstrapperInterface;

class Bootstrapper implements BundleBootstrapperInterface
{
    public function setConfiguration(array $configuration = [])
    {}

    public function setup()
    {}

    public function tearDown()
    {}
}

A bundle bootstrapper has the two lifecycle methods 'setup' and 'tearDown', which are called by the bundle manager. 'setup' will be called, when the bundle gets started and 'tearDown' will be called at the very end of the PHP execution.

About

Bundle manager for the merophp framework.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages