Installation Add the bundle via Composer (if still viable, despite archival):
composer require ajgl/cpm-bundle
Register in config/bundles.php (Symfony 2.x):
Ajgl\CpmBundle\AjglCpmBundle::class => ['all' => true],
First Use Case Define a JavaScript dependency in a Twig template:
{% javascripts
'@AjglCpmBundle/Resources/public/cpm.js'
filter='cpm'
%}
<script src="{{ asset(url) }}"></script>
{% endjavascripts %}
Ensure cpm.js is a CPM-compatible loader (e.g., CPM’s official loader).
Dependency Management
filter='cpm') to process CPM-compatible manifests.cpm.json):
{
"main": "path/to/entry.js",
"dependencies": {
"dojo": "1.10.4",
"dgrid": "0.5.0"
}
}
{% javascripts '@YourBundle/Resources/public/cpm.json' filter='cpm' %}
Asset Pipeline
Asset component to resolve CPM-managed paths.?v={{ timestamp }} to generated <script> tags.Symfony Integration
AjglCpmBundle\Dependency\DependencyManager to add custom CPM resolvers.Archival Warning
CPM Compatibility
cpm install --dry-run
Symfony 2.x Constraint
Resources/doc/index.md for filter syntax nuances.cpm install -v
app/Resources/public paths are correct.Custom Resolvers
Extend AjglCpmBundle\Dependency\Resolver\BaseResolver to support private CPM registries.
Twig Filters
Override AjglCpmBundle\Twig\Extension\CpmExtension to add pre/post-processing.
Build Automation
Hook into post-install-cmd in composer.json to auto-run cpm install:
"scripts": {
"post-install-cmd": [
"Ajgl\\CpmBundle\\Composer\\ScriptHandler::postInstall"
]
}
How can I help you explore Laravel packages today?