Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Custom Assets Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • 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.

    • Laravel’s public/ directory is treated as a static asset root, while Symfony’s assets:install is part of a twig/asset pipeline.
    • The package’s reliance on YAML configuration and Symfony’s Asset component is incompatible with Laravel’s Blade/Asset helpers and service container.
  • Use Case Alignment:

    • If the goal is static asset management (e.g., copying vendor/third-party assets to public/), Laravel already provides:
      • npm run dev/prod (for compiled assets).
      • Manual cp -r or rsync for static files.
      • Laravel Mix or Vite for bundling.
    • If the goal is dynamic asset versioning (e.g., Symfony’s asset() function), Laravel uses:
      • mix.version() or vite('resource.js') for fingerprinting.
      • No need for a separate "install" step.

Integration Feasibility

  • Low Feasibility for Laravel:

    • Requires Symfony’s Asset component, which Laravel does not use.
    • Kernel-based bundle registration (AppKernel.php) is obsolete in Laravel (since v5.5+ uses auto-wiring and PSR-4).
    • Composer script hook (Step 3) assumes Symfony’s asset pipeline, which Laravel replaces with npm scripts or Artisan commands.
  • Workarounds (High Effort):

    • Could be forked/modified to work with Laravel’s ServiceProvider and Artisan commands.
    • Would need to replace Symfony’s Asset logic with Laravel’s Asset helper or mix-manifest.json.
    • No native support for Laravel’s Blade directives (@asset, @mix).

Technical Risk

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.

Key Questions

  1. Why not use Laravel’s native asset pipelines (Mix/Vite) instead of reinventing this?
  2. What specific problem does this solve that cp -r, rsync, or npm run build doesn’t?
  3. Is Symfony interoperability a hard requirement, or is this a one-off need?
  4. What’s the long-term maintenance plan if this is forked for Laravel?
  5. Are there existing Laravel packages (e.g., laravel-mix, spatie/laravel-assets) that already solve this?
  6. How will this interact with Laravel’s caching (e.g., config('app.asset_url'))?
  7. What’s the failure mode if the custom_assets directory already exists?

Integration Approach

Stack Fit

  • Incompatible with Laravel’s Default Stack:

    • Laravel uses:
      • Frontend: Vite, Laravel Mix, or Inertia.js.
      • Asset Handling: public/storage, mix-manifest.json, or asset() helper.
      • Dependency Management: npm/yarn, not Symfony’s assets:install.
    • This package does not integrate with any of these.
  • Possible Stacks Where It Might Fit:

    • Hybrid Symfony/Laravel apps (e.g., using Laravel as an API backend with Symfony frontend components).
    • Legacy Symfony migrations where some parts are being converted to Laravel.
    • Custom monorepos where Symfony and Laravel coexist (uncommon).

Migration Path

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:

  1. Abandon the package if native Laravel solutions suffice.
  2. Fork and rewrite for Laravel:
    • Replace LinkinCustomAssetsBundle with a ServiceProvider.
    • Replace YAML with Laravel’s config().
    • Replace assets:install with an Artisan command.
    • Use Laravel’s Storage facade for file operations.
  3. Alternative: Use laravel-mix to copy vendor assets:
    // mix.js
    mix.copy('node_modules/some-package/assets', 'public/custom_assets');
    

Compatibility

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.

Sequencing

  1. Assess Need:
    • Confirm if this solves a unique problem not covered by Laravel Mix/Vite.
  2. Prototype:
    • Test copying assets manually (cp -r) to validate the workflow.
  3. Fork or Replace:
    • If proceeding, fork the repo and adapt it for Laravel.
  4. Integrate:
    • Register as a ServiceProvider.
    • Replace YAML with Laravel config.
    • Add an Artisan command.
  5. Test:
    • Verify asset paths in Blade (@asset('custom_assets/file.js')).
    • Check caching behavior (php artisan cache:clear).

Operational Impact

Maintenance

  • High Overhead:
    • No Laravel-specific updates: The package is abandoned (0 stars, no activity).
    • Symfony dependency drift: Future Symfony updates may break Laravel compatibility.
    • Custom patches required: Any Laravel-specific changes must be maintained indefinitely.
  • Alternatives:
    • Laravel’s mix.copy() or rsync require no maintenance.
    • A custom Artisan command would be easier to debug than a forked bundle.

Support

  • No Community Support:
    • No Laravel-specific documentation, issues, or pull requests.
    • Debugging would rely on Symfony’s asset pipeline, which is alien to Laravel.
  • Vendor Lock-in:
    • Tied to a single maintainer (adrenalinkin) with no backup plan.
  • Error Modes:
    • Broken asset paths: If YAML config is misconfigured, assets may not copy.
    • Permission issues: public/custom_assets may need chmod -R 755.
    • Conflicts with Laravel Mix: If both try to write to public/, race conditions may occur.

Scaling

  • Performance:
    • File copying on composer install could slow deployments.
    • No incremental updates: Full recopy on every composer update.
  • Alternatives Scale Better:
    • Laravel Mix: Only copies what’s needed (mix.copy).
    • CDN/Storage: Offload assets to S3/AWS instead of public/.
  • Horizontal Scaling:
    • If using queue workers, asset copying could block deployment.

Failure Modes

Failure Scenario Impact Mitigation
Composer install fails Deployment blocked Use post-install-cmd with error handling.
**
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware