Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

eimanavicius/cakephp-container-interop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Container Interop in CakePHP

Container Interoperability plugin for CakePHP 2.x. This plugin adds the ability to easy configure any service containers compatible with container-interop.

It provides the clean component to access you container or services in container. Also you get container registered in ClassRegistry that allows you to gradually migrate your application.

Installation

Installation through composer is HIGHLY RECOMMENDED. Installation can be done manually, but requires a lot more steps and is not supported officially.

composer

composer require eimanavicius/cakephp-container-interop

or add requirement to your composer.json file manually and don't forget to run composer update

{
  "require": {
    "eimanavicius/cakephp-container-interop": "^0.0"
  }
}

Configuration

Plugin loading

Load the plugin as any other plugin in app/Config/bootstrap.php:

CakePlugin::load('ContainerInterop', array('bootstrap' => true));

The bootstrap file must be loaded, to set up all configurations needed.

Add pre-configured service container

By installing Zend Service Manager plugin.

More pre-configured service containers will be provided as they appear.

Or configure your container instance

By default container is loaded from file app/Config/container.php (file should return configured service container instance as in sample below). You can change file location by specifying config value before plugin load:

Configure::write('Interop\Container\ContainerInterface', 'app/Config/container.php');

app/Config/container.php sample

<?php

// Build container
$container = new SomeServiceContainer();

return $container;

About

Container Interoperability plugin for CakePHP 2.x

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages