oomphinc/composer-installers-extender
Extends Composer Installers to add custom installer types and paths without forking. Define extra installer mappings for plugins/themes/modules and other packages, keeping your project’s directory structure consistent across Composer installs.
composer/installers) to support arbitrary package types (e.g., custom vendor types like laravel-module, theme, or domain-specific packages). It is ideal for Laravel projects where:
app/Modules/, resources/themes/).post-install, post-update) to automate post-installation tasks (e.g., symlinking, configuration generation).composer/installers (which maps packages to vendor/).laravel-modules or custom module systems) by allowing packages to install into app/ or other non-vendor paths.composer/installers without modifying Laravel’s core, making it backward-compatible.composer.json, define custom types in extra.installer-types, and specify target directories in package composer.json.composer require oomphinc/composer-installers-extender
composer.json to recognize custom types:
{
"extra": {
"installer-types": {
"laravel-module": "vendor/module",
"theme": "resources/themes/%package%"
}
}
}
composer.json:
{
"type": "laravel-module",
"extra": {
"installer-name": "module"
}
}
PackageServiceProvider and follow Laravel’s conventions.illuminate/modules or custom solutions (e.g., spatie/laravel-module-stub).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Package Type Conflicts | Medium | Validate custom types against existing composer/installers types; document naming conventions. |
| Directory Permissions | Low | Ensure target directories (e.g., app/Modules/) are writable by Composer. |
| Laravel Caching | Low | Clear Laravel’s config, routes, and views caches post-install if packages modify these. |
| Deprecation Risk | Low | Monitor composer/installers updates; this package is a thin wrapper. |
| Custom Logic Errors | Medium | Test post-install scripts (e.g., symlinks, config publishing) in CI. |
spatie/laravel-package-tools) that could replace or complement this?| Phase | Action | Tools/Commands |
|---|---|---|
| Assessment | Audit existing package types; identify gaps (e.g., themes, plugins). | composer show --installed |
| Configuration | Add oomphinc/composer-installers-extender and define installer-types in composer.json. |
composer require oomphinc/composer-installers-extender |
| Package Adaptation | Update custom packages to declare types (e.g., "type": "laravel-module"). |
Manual composer.json edits or a script to bulk-update packages. |
| Testing | Validate installations in a staging environment. | composer install --prefer-dist --no-dev |
| CI/CD Integration | Add post-install steps to CI pipelines (e.g., cache clearing, asset compilation). | Custom CI scripts or Laravel Forge/Envoyer hooks. |
| Rollout | Deploy to production; monitor for issues (e.g., permission errors). | Gradual rollout with feature flags if needed. |
post-install-cmd scripts.illuminate/modules or custom module systems (e.g., nWidart/laravel-modules).spatie/laravel-theme or custom theme systems.laravel-package-tools if using auto-discovery.post-install-cmd scripts (e.g., php artisan package:discover).composer.json and CI/CD.composer/installers and composer-installers-extender for breaking changes.composer.json for orphaned or misconfigured installer-types.Permission denied errors in target directories (e.g., app/Modules/).post-install-cmd scripts (e.g., missing dependencies, syntax errors).No installer found for package → Verify installer-types and package composer.json type.Directory not writable → Adjust permissions or use COMPOSER_HOME to cache files.Class not autoloaded → Ensure packages include autoload rules and use Laravel’s auto-discovery.composer diagnose → Check environment issues.composer dump-autoload → Regenerate autoloader if classes are missing.php artisan package:discover → Force-discover packages if auto-discovery fails.PACKAGE_TYPES.mdHow can I help you explore Laravel packages today?