c33s/composer-construction-kit-installer
Composer plugin for C33s Construction Kit: detects installed packages with the c33s-building-blocks extra and writes a list of blocks to {$appDir}/config/config/c33s_construction_kit.composer.yml for use by c33s/construction-kit-bundle.
Install the Plugin
Add the plugin to your project's composer.json under config.extra.plugins:
{
"config": {
"extra": {
"plugins": {
"c33s/composer-construction-kit-installer": {
"type": "composer-plugin",
"version": "dev-main" // or latest stable version
}
}
}
}
}
Run composer install or composer update to trigger the plugin.
Verify Activation Check for the generated config file at:
config/config/c33s_construction_kit.composer.yml
This file lists all detected c33s-building-blocks packages.
First Use Case
Install a package with the c33s-building-blocks extra (e.g., c33s/construction-kit-bundle or a custom block).
Example:
composer require c33s/construction-kit-bundle
The plugin auto-generates the config file, which the ConstructionKitBundle reads to load blocks.
Symfony Flex Compatibility
post-update-cmd script.Custom Block Registration
composer.json includes:
{
"extra": {
"c33s-building-blocks": {
"your-block-name": {
"type": "form|twig|controller|...",
"path": "src/Resources/your-block-resources"
}
}
}
}
c33s_construction_kit.composer.yml.Conditional Block Loading
if key in your block’s composer.json to conditionally load blocks:
{
"extra": {
"c33s-building-blocks": {
"conditional-block": {
"type": "twig",
"path": "templates",
"if": "env(APP_ENV) == 'dev'"
}
}
}
}
Environment-Specific Blocks
{
"extra": {
"c33s-building-blocks": {
"prod-only-block": {
"type": "controller",
"path": "src/Controller",
"if": "phpversion() >= '8.0'"
}
}
}
}
Post-Install Scripts
composer run-script post-update-cmd
Disabling the Plugin
composer.json:
{
"extra": {
"c33s-construction-kit-disabled": true
}
}
composer.json.Missing post-update-cmd Hook
config.extra.plugins (not require-dev).scripts section includes post-update-cmd (Symfony Flex adds this by default).composer dump-autoload --verbose
Incorrect Block Paths
path in c33s-building-blocks must be relative to the package root. Absolute paths or incorrect paths will cause the block to fail silently.c33s_construction_kit.composer.yml.Circular Dependencies
Case Sensitivity
c33s-building-blocks are case-sensitive. Ensure consistency between the composer.json and the ConstructionKitBundle configuration.Plugin Conflicts
post-update-cmd, the installer may not run. Check for conflicts with:
composer why-not c33s/composer-construction-kit-installer
Dry Run
composer run-script post-update-cmd -- --dry-run
stderr.Log Generation
composer.json:
{
"config": {
"log": true,
"log-level": "verbose"
}
}
~/.composer/logs/ or project-specific logs.Manual Validation
cat config/config/c33s_construction_kit.composer.yml
Custom Block Types
BlockDetector class to handle custom type values in c33s-building-blocks.Pre/Post-Processing
post-update-cmd script. Example:
{
"scripts": {
"post-update-cmd": [
"c33s-construction-kit-installer",
"@php bin/console c33s:construction-kit:post-process"
]
}
}
Dynamic Block Conditions
if key by leveraging Composer’s platform-check or custom scripts:
{
"extra": {
"c33s-building-blocks": {
"dynamic-block": {
"type": "service",
"path": "src/Service",
"if": "file_exists('/path/to/feature-flag')"
}
}
}
}
Multi-Environment Configs
ConfigWriter class to write to c33s_construction_kit.{env}.yml.Symlink Handling
vendor/), ensure the plugin runs in the correct working directory. Symfony Flex handles this, but custom setups may need:
cd /path/to/project && composer update
Platform-Specific Paths
C:\path on Windows). Use forward slashes or Composer’s platform-check to normalize paths.Caching Issues
composer clear-cache
c33s_construction_kit.composer.yml and rerun composer update to force regeneration.How can I help you explore Laravel packages today?