- How does composer/installers improve Laravel development workflows?
- It automates the placement of package assets (plugins, themes, modules) into the correct Laravel directories (e.g., public/, config/) during `composer install`, eliminating manual `php artisan` commands like `link-storage` or `vendor:publish`. This speeds up local setup and CI/CD pipelines by handling asset linking upfront.
- Can I use this package with Laravel 5.5 or older versions?
- The package officially supports Laravel 5.5+, but older versions may require additional configuration or a compatible fork of the `composer/installers` package. Always test thoroughly in your environment, especially if using custom directory structures.
- What’s the difference between `type:asset`, `type:config`, and `type:module` in installers?
- `type:asset` places files in `public/`, `type:config` in `config/`, and `type:module` in `app/` (or custom paths). These types map to Laravel’s conventions, but you can override them in `composer.json` under `extra/installer-paths` for non-standard setups.
- Will this package conflict with Laravel Forge or Envoyer?
- Potential conflicts can arise if both tools and the installer use `post-install-cmd` hooks. To mitigate this, explicitly order hooks in `composer.json` or use Forge/Envoyer’s configuration to defer to the installer’s logic. Test in staging before production.
- How do I configure custom install paths for a Laravel project?
- Add an `extra/installer-paths` section to your `composer.json`. For example, to install assets in `public/custom/`, use: `"public/custom/{$name}": ["type:asset"]`. This overrides default paths while maintaining compatibility with Laravel’s structure.
- Does this package work in multi-framework PHP projects (e.g., Laravel + Symfony)?
- Yes, but with caveats. The package is framework-agnostic and relies on `installer-paths` definitions. However, mixing frameworks risks unintended asset linking. Use it selectively and document custom paths clearly in `composer.json`.
- How can I test if the installer is working correctly in CI?
- Run `composer install --no-dev --prefer-dist` in your CI pipeline and verify asset links (e.g., check if `public/storage` symlinks exist). Use `composer validate` to catch JSON syntax errors in `installer-paths` early.
- What’s the performance impact of using this package?
- The overhead is minimal for most projects, as it only runs during `composer install` or `update`. Benchmark with `composer install --profile` to compare build times. If performance is critical, consider disabling hooks in production via `composer.json`.
- Can I use this package without Laravel (e.g., for a custom PHP app)?
- Yes, but you’ll need to define custom `installer-paths` in `composer.json` to match your project’s directory structure. The package isn’t Laravel-specific—it’s a Composer extension for any PHP project needing structured asset installation.
- How do I handle environment-specific asset paths (e.g., staging vs. production)?
- Avoid hardcoding paths in `installer-paths`. Instead, use environment variables or Laravel’s `config/` overrides to dynamically adjust paths. For example, set `PUBLIC_PATH=public/staging` in your CI environment and reference it in custom installers.