adrenalinkin/custom-assets-bundle
Symfony bundle to install assets from custom source folders into your project’s public/custom_assets directory, similar to assets:install. Configure one or more source paths via YAML and optionally run automatically via a Composer post-install/update script.
Symfony/Laravel Compatibility: The package is designed for Symfony (evident from AppKernel.php and assets:install reference), not Laravel. Laravel uses Mix/Vite or Laravel Mix for asset compilation, not Symfony’s asset pipeline. This creates a fundamental mismatch in architecture.
public/ directory is treated as a static asset root, while Symfony’s assets:install is part of a twig/asset pipeline.Asset component is incompatible with Laravel’s Blade/Asset helpers and service container.Use Case Alignment:
public/), Laravel already provides:
npm run dev/prod (for compiled assets).cp -r or rsync for static files.asset() function), Laravel uses:
mix.version() or vite('resource.js') for fingerprinting.Low Feasibility for Laravel:
Asset component, which Laravel does not use.AppKernel.php) is obsolete in Laravel (since v5.5+ uses auto-wiring and PSR-4).Workarounds (High Effort):
ServiceProvider and Artisan commands.Asset logic with Laravel’s Asset helper or mix-manifest.json.@asset, @mix).| Risk Area | Severity | Notes |
|---|---|---|
| Architecture Mismatch | Critical | Symfony vs. Laravel asset pipelines are incompatible. |
| Dependency Bloat | High | Adds Symfony components unnecessarily. |
| Maintenance Overhead | High | Requires custom patches to work in Laravel. |
| Performance Impact | Medium | YAML parsing + file copying may slow composer install. |
| Security Risks | Medium | Custom asset paths could introduce path traversal if not sanitized. |
| Lack of Laravel Ecosystem | High | No Laravel-specific documentation, tests, or community support. |
cp -r, rsync, or npm run build doesn’t?laravel-mix, spatie/laravel-assets) that already solve this?config('app.asset_url'))?custom_assets directory already exists?Incompatible with Laravel’s Default Stack:
public/storage, mix-manifest.json, or asset() helper.npm/yarn, not Symfony’s assets:install.Possible Stacks Where It Might Fit:
| Step | Action | Laravel Equivalent | Notes |
|---|---|---|---|
| 1 | composer require |
composer require |
Works, but pulls Symfony dependencies. |
| 2 | Enable Bundle (AppKernel.php) |
Not applicable | Laravel uses config/app.php for providers. |
| 3 | Run composer post-install |
Replace with Artisan command | Would need a custom php artisan custom:assets:install. |
| 4 | YAML Config | JSON/ENV Config | Laravel prefers .env or config/custom_assets.php. |
| 5 | Asset Symlinking | Manual cp or rsync |
Or use laravel-mix for vendor assets. |
Recommended Migration Path:
LinkinCustomAssetsBundle with a ServiceProvider.config().assets:install with an Artisan command.Storage facade for file operations.laravel-mix to copy vendor assets:
// mix.js
mix.copy('node_modules/some-package/assets', 'public/custom_assets');
| Component | Compatibility | Workaround |
|---|---|---|
Symfony Asset Component |
❌ No | Replace with Laravel’s asset() or mix(). |
| YAML Config | ❌ No | Use Laravel’s config() or .env. |
assets:install Command |
❌ No | Create a custom php artisan custom:assets:install. |
| Kernel Bundle Registration | ❌ No | Use AppServiceProvider::register(). |
| Composer Script Hooks | ✅ Yes (but useless) | Replace with post-install-cmd in composer.json. |
cp -r) to validate the workflow.ServiceProvider.Artisan command.@asset('custom_assets/file.js')).php artisan cache:clear).mix.copy() or rsync require no maintenance.Artisan command would be easier to debug than a forked bundle.public/custom_assets may need chmod -R 755.public/, race conditions may occur.composer install could slow deployments.composer update.mix.copy).public/.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Composer install fails | Deployment blocked | Use post-install-cmd with error handling. |
| ** |
How can I help you explore Laravel packages today?