contao-components/installer
Custom Composer installer for Contao components. Installs packages of type "contao-component" into a dedicated directory (e.g., assets) configured via composer.json extra "contao-component-dir".
plugins/). This aligns with Laravel’s ecosystem (e.g., Livewire, Nova) but with stricter isolation.auth-system, payment-gateway) are versioned independently in private Packagist repos, reducing monorepo bloat and enabling parallel development.vendor/ symlinks or require hacks with a standardized installation process, improving reproducibility (e.g., composer require vendor/plugin:1.0).composer/installers or Laravel Packages instead).autoload for non-standard paths).laravel/framework, illuminate/) that conflict with Contao’s LGPL-3.0 license.composer require vendor/package with PSR-4 autoloading (no custom installer needed).composer/installers with a custom plugin or symlinks in composer.json.*"This package lets us modernize our Contao-based products without a full rewrite by treating Contao plugins as ‘Laravel-compatible’ components. Imagine taking a legacy Contao site—with its custom admin panels, widgets, or integrations—and gradually replacing them with Laravel-powered modules, all managed via Composer. For example:
Why now?
Risk: Requires a small upfront investment to standardize our Composer/Laravel workflow. But the payoff is long-term flexibility."*
*"This installer solves a specific pain point: How do we mix Contao components with Laravel without breaking autoloading or dependencies? Here’s the playbook:
plugins/ (configurable via contao-component-dir) instead of vendor/.composer.json:
{
"require": {
"vendor/contao-plugin": "^1.0",
"contao-components/installer": "^1.0"
},
"extra": {
"contao-component-dir": "plugins"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Contao\\Plugin\\": "plugins/" // Map Contao namespaces
}
}
}
plugins/ are resolved via PSR-4 (test with composer dump-autoload).config/app.php if they need Laravel services (e.g., App\Services\ContaoBridge).TL_* global functions).composer.json:
"config": {
"platform-check": false,
"preferred-install": "dist"
}
plugins/vendor/—add this to your IDE’s include path.new \Contao\Plugin\Widget()).vendor/ (composer why-not).ServiceProviders (e.g., convert TL_ROOT to config('contao.root')).composer validate (dependency conflicts).php artisan optimize:clear (autoload cache).plugins/ to vendor/ (risky for updates).Next Steps:
Trade-off: This is not a silver bullet—it’s a temporary bridge. Plan to rewrite components as Laravel Packages within 6–12 months."*
*"Here’s how to install and use Contao components in Laravel without pulling your hair out:
composer require contao-components/installer
Add to your composer.json:
"extra": {
"contao-component-dir": "plugins"
},
"autoload": {
"psr-4": {
"Contao\\": "plugins/"
}
}
Run:
composer dump-autoload --optimize
composer require vendor/contao-plugin:^1.0
This installs the plugin to plugins/vendor/contao-plugin/.
new \Contao\Plugin\MyClass()).resources/views/plugins/vendor/contao-plugin/.routes/web.php:
Route::prefix('contao')->group(function () {
require plugin_path('vendor/contao-plugin/routes.php');
});
| Problem | Solution |
|---|---|
| Class not found | Run composer dump-autoload. |
TL_ROOT undefined |
Use config('contao.root') or a Service Provider. |
| Database conflicts | Migrate Contao tables to Laravel migrations. |
How can I help you explore Laravel packages today?