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.x | 2.1.x | 2.2.x | 2.3.x | 2.4.x | 2.5.x | 2.6.x | 2.7.0 | 2.7.1 | 2.7.2 | 2.7.3 | 2.7.4 | 2.7.5 | 2.7.6 | 2.7.7 | 2.7.8 | 2.7.9 | 2.7.10 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
No | No | No | No | No | 0.1 | No | No | No | No | No | No | No | No | No | No | No | No. Soon? |
Readme
Composer for Symphony
Integrate third party APIs into Symphony CMS using Composer.
Installation
- Upload the 'composerforsymphony' folder in this archive to your Symphony 'extensions' folder.
- Enable it by selecting the "Composer for Symphony", choose Enable from the with-selected menu, then click Apply.
- 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