- How do I install this Composer plugin installer for Craft CMS plugins?
- Add the installer to your project’s `composer.json` under `extra.installer-paths` with the key `type:craft-plugin` pointing to your plugins directory. Run `composer require vendor/plugin` to install plugins via Composer, just like Laravel packages. No Craft CLI changes are needed.
- Does this work with Craft CMS 3.x or only 4.x?
- This installer supports both Craft CMS 3.x and 4.x, but full Composer 2.x features (like modern plugin APIs) are optimized for Craft 4.x. Craft 3.x may require additional configuration for private repositories or custom plugin sources.
- Can I use this for private Packagist repositories or internal plugin sources?
- Yes, the installer fully supports private repositories. Configure your `composer.json` with repository URLs under `repositories`, and use `composer require` as usual. Authentication (e.g., SSH keys or tokens) works the same way as standard Composer setups.
- What happens if a plugin fails to install? Does it roll back?
- The installer follows Composer’s native behavior: if a plugin fails to install, Composer will abort the transaction and leave your system unchanged. No partial installations occur. Check the error logs for troubleshooting steps.
- Will this replace the `craft install-plugin` command, or do I need both?
- You can phase out `craft install-plugin` entirely. Once configured, use `composer require vendor/plugin` for all installations and updates. The installer integrates with Craft’s plugin system automatically, so no dual workflow is needed.
- Are there performance issues with large plugin ecosystems or parallel installs?
- The installer leverages Composer’s dependency resolution and parallel download capabilities, so performance scales with your system resources. For very large ecosystems, monitor `composer.json` constraints to avoid excessive version conflicts.
- How does this handle conflicting plugin dependencies (e.g., two plugins needing different versions of the same library)?
- Conflicts are resolved using Composer’s dependency solver, just like Laravel packages. If no solution exists, Composer will fail the install. Craft CMS’s `composer.json` constraints (e.g., PHP/Laravel version requirements) help mitigate most conflicts.
- Do plugin developers need to modify their plugins to work with this installer?
- No changes are required for standard Craft plugins distributed via Packagist. However, plugins with custom installation scripts or non-PHP assets (e.g., Node.js tools) may need minor adjustments to ensure compatibility with Composer’s lifecycle hooks.
- Is there documentation or best practices for optimizing plugins for this installer?
- The installer follows Craft CMS’s existing plugin standards, so no additional documentation is provided yet. However, Craft’s official plugin guidelines (e.g., using `craft install-plugin` as a reference) apply here. Check Packagist for plugin-specific notes.
- What’s the migration path from `craft install-plugin` to this Composer installer?
- Start by testing non-critical plugins with the installer. Update your project’s `composer.json` to include `installer-paths`, then replace `craft install-plugin` commands with `composer require`. Monitor for issues, then gradually adopt it for all plugins.