39. Private Repositories, Packagist
•
Packagist is an Open Source project
•
It is built as a Symfony application
•
You can have your own private Packagist
•
Supports Github Webhooks
45. Installers, building your own installer
{
"name": "welovephp/blog-module",
"type": “welovephp-module",
"require": {
“welovephp/module-installer-plugin“: "*"
}
}
46. Installers, building your own installer
{
"name": “welovephp/module-installer-plugin",
"type": "composer-plugin",
"autoload": {
"psr-0": {"WeLovePhpComposer": "src/"}
},
"extra": {
"class": "WeLovePhpComposerModuleInstallerPlugin"
},
"require": { "composer-plugin-api": “1.0.0"
}
}
47. Installers, building your own installer
namespace WeLovePhpComposer;
class ModuleInstallerPlugin implements PluginInterface
{
public function activate(Composer $composer, IOInterface $io)
{
$installer = new ModuleInstaller($io, $composer);
$composer->getInstallationManager()->addInstaller($installer);
}
}
48. Installers, building your own installer
namespace phpDocumentorComposer;
!
class ModuleInstaller extends LibraryInstaller
{
public function getPackageBasePath(PackageInterface $package)
{
return 'welovephp/modules/'.$package->getPrettyName();
}
!
public function supports($packageType)
{
return ‘welovephp-module' === $packageType;
}
}
50. Embedded Composer, the problem
•
You have an application
•
Your application has dependencies
•
Your application can be extended via third-party
plugins
•
Those plugins depend on your app, but can have
other extra dependencies
•
Both, app & plugins dependencies, must be installed
once and be compatible between them