0.1experimentalComposer for Symphony

Integrate third party APIs into Symphony CMS using Composer.

Clone URLhttps://github.com/psychoticmeow/composer_for_symphony.git

Add as a submodulegit submodule add https://github.com/psychoticmeow/composer_for_symphony.git extensions/composer_for_symphony --recursive

Compatibility

2.x.x2.1.x2.2.x2.3.x2.4.x2.5.x2.6.x2.7.0
NoNoNoNoNo0.1NoNo. Soon?

Readme

Composer for Symphony

Integrate third party APIs into Symphony CMS using Composer.

Installation

  1. Upload the 'composerforsymphony' folder in this archive to your Symphony 'extensions' folder.
  2. Enable it by selecting the "Composer for Symphony", choose Enable from the with-selected menu, then click Apply.
  3. Go to the Preferences page and under "Composer for Symphony" enter the path to composer.json relative to the root of your installation.

Usage

Composer for Symphony makes sure that the Composer autoloader is loaded as early as possible, giving you easy access to any libraries you have installed. You can integrate with Composer by adding the following delegate to your own extensions:

php public function getSubscribedDelegates() { return [ [ 'page' => '/all/', 'delegate' => 'ComposerReady', 'callback' => 'onComposerReady' ] ]; }

This delegate is called when the composer autoloader is initialised, giving you easy access as early as possible during Symphony execution:

php public function onComposerReady($context) { // Add a PSR-4 library: $context['autoloader']->setPsr4('Your\Namespace\', __DIR__ . '/lib'); }

In addition to this, the autoloader can be accessed at any time by calling:

php Symphony::ExtensionManager()->create('composer_for_symphony')->getAutoloader();

And the configuration file can be read by calling:

php Symphony::ExtensionManager()->create('composer_for_symphony')->getConfiguration();

For a complete look at what is possible with the Composer autoloader, have a look at the ClassLoader documentation.

Version history

Symphony 2.5 to 2.5.x