- What is jeroen-g/autowire and how does it work in Laravel?
- jeroen-g/autowire is a Laravel Composer package that uses PHP 8 attributes to resolve and wire class dependencies automatically, reducing manual service container boilerplate. Instead of binding and injecting everything by hand, you annotate classes and let the package handle construction and configuration. It keeps controllers and services cleaner and easier to maintain.
- How do I install jeroen-g/autowire with Composer?
- Install it with Composer by running composer require jeroen-g/autowire. Laravel package discovery registers the service provider automatically, so a manual provider entry is usually unnecessary. Check the repository README for any optional configuration or publishing steps, and confirm the version constraint matches your PHP and Laravel versions.
- Which PHP and Laravel versions does jeroen-g/autowire 3.0 support?
- Version 3.0.0 removes support for end-of-life PHP and Laravel releases, so you need a currently supported runtime and framework version. Laravel 13 support was added in this release. Check the package composer.json and release notes for the exact minimum constraints before upgrading, since the overview here does not list the precise version numbers.
- What breaking changes are in jeroen-g/autowire 3.0?
- The headline breaking change in 3.0.0 is dropped support for EOL PHP and Laravel versions, which is expected SemVer-major behavior. The release notes do not describe removed APIs, renamed methods, or behavioural changes beyond that platform floor. Confirm against the upgrade guide and diff, then run your full test suite, especially container-heavy tests, after upgrading.
- How do I autowire dependencies using PHP 8 attributes?
- You annotate classes, constructor parameters, or properties with the package's PHP 8 attributes, and the package resolves and wires the dependencies for you. This replaces repetitive container bindings for straightforward dependency graphs. For complex or conditional bindings you may still want explicit service provider definitions.
- What is WithCachedAutowire and should I use it in my tests?
- WithCachedAutowire is a test trait introduced in 3.0.0 that caches autowiring resolution to speed up test suites. It fits naturally into Laravel test suites using PHPUnit or Pest. Pilot it on a subset of tests first and watch for state leakage in tests that mutate container bindings, since caching can interact poorly with tests expecting a fresh container.
- Can I upgrade from jeroen-g/autowire 2.x to 3.0 safely?
- Treat 3.0.0 as a platform-upgrade release rather than a drop-in dependency bump. Confirm your application runs on supported PHP and Laravel versions, then upgrade in a non-production branch and run the full test suite. Check for a published upgrade guide documenting a deprecation path from 2.x; if you are pinned to EOL platforms, stay on the latest 2.x release while it remains supported.
- Does jeroen-g/autowire work with Laravel 13?
- Yes, version 3.0.0 adds Laravel 13 support. If your application is not yet on Laravel 13, that is a forward-looking benefit rather than an immediate reason to upgrade. Validate your Composer constraints against your actual Laravel version before adopting.
- What is the Laravel Boost skill included in version 3.0?
- Release 3.0.0 includes a Laravel Boost skill for teams using Laravel's AI-assisted development tooling. It is additive developer tooling and should be treated as opt-in, separate from application runtime concerns. Validate separately whether it requires a specific Laravel Boost version and whether Boost is installed and configured in your project.
- What are alternatives to jeroen-g/autowire for dependency injection in Laravel?
- Alternatives include Laravel's built-in contextual binding and manual service provider bindings, or other attribute-based autowiring packages. jeroen-g/autowire fits well when you want attribute-driven injection without boilerplate and you are on supported PHP and Laravel versions. For legacy apps pinned to EOL runtimes, explicit bindings or the latest 2.x release may be the safer choice.