- How do I install kirschbaum-development/laravel-actions?
- Install it with Composer as kirschbaum-development/laravel-actions; it is a Composer-only, MIT-licensed package with minimal expected transitive weight. Before committing, check the package's composer.json constraints against your application's Laravel and PHP versions. There is no separate service provider configuration described in the overview, so installation is primarily a dependency and code-structure decision.
- Which Laravel and PHP versions does laravel-actions support?
- The provided context does not state a supported Laravel or PHP matrix, so verify the illuminate/* and php constraints in composer.json before adopting it. The package is at v0.2.3 and pre-1.0, so there is no stated compatibility promise or deprecation policy in the material reviewed. Confirm support for your currently supported Laravel major and run the test suite in a spike branch.
- How is this different from lorisleiva/laravel-actions?
- Both packages implement the action pattern: one class encapsulates a unit of business logic and can be invoked from controllers, jobs, listeners, or commands. lorisleiva/laravel-actions has far greater adoption, while kirschbaum-development/laravel-actions has around seven stars and zero dependents at v0.2.3. Running both in one codebase is an architectural smell, not a feature, so choose one convention.
- Can I reuse the same action class in a controller, a queued job, and an event listener?
- Yes; that reuse across Laravel entry points is the package's core design goal, avoiding duplicate classes per context. The main caveat is serialization: an action that accepts request-bound dependencies in HTTP may not serialize cleanly when queued. Stricter constructor typing in v0.2.3 may surface non-serializable state earlier at dispatch, which is a mild improvement.
- Does kirschbaum-development/laravel-actions work with PHPStan and Larastan?
- v0.2.3 focused on static analysis with improved parameter and return type declarations on the package surface, which makes PHPStan and Larastan cleanliness more achievable. However, typing the package's own surface does not automatically type your action classes. Expect to add Larastan rules and likely stubs or generics for the dispatch entry points to get clean analysis of your own actions.
- Is it safe to dispatch an action as a queued job?
- Queued actions must serialize cleanly, so constructor dependencies and properties need to be queue-safe. The context notes that serialization semantics are unchanged in v0.2.3, though stricter constructor typing may reveal non-serializable state earlier. Test one low-risk queued job as an action behind a feature flag before converting more.
- Is v0.2.3 stable enough for production use?
- v0.2.3 is a positive maintenance data point, but it is pre-1.0 with a single maintainer, low visibility, seven stars, and zero dependents. The adoption and bus-factor risk is high because a stall would be absorbed entirely by your team. A timeboxed spike converting one well-tested controller and one queued job behind a feature flag is the safer path before broad adoption.
- Can patch releases break my code if I subclass an action?
- Yes, potentially. Improved parameter and return type declarations shipped in a patch release can be a de facto breaking change for anyone subclassing an action, overriding a method, or stubbing actions in tests with loose signatures. Pre-1.0 semver gives no compatibility guarantee, so read the diff for each bump rather than relying only on a green CI run.
- How should I test actions in a Laravel application?
- Actions are intended as plain, testable classes that encapsulate business logic, so unit-test their invocation and outcomes directly and assert that controllers, jobs, and listeners delegate to them. If you stub actions in tests, keep signatures aligned with the package's typed declarations to avoid breakage on patch upgrades. The context does not describe package-provided testing helpers, so verify behavior with your own PHPUnit or Pest tests in the spike.
- Should I use this package in a multi-framework or standalone codebase?
- No, not without caution: business logic in an action becomes bound to a framework-specific trait or base class, reducing portability to non-Laravel consumers such as standalone workers, CLI tools, or other services. It fits best when the codebase is Laravel-native with no multi-framework constraint and the team is on a currently supported Laravel major. If portability matters, keep core logic in framework-agnostic services and use actions only as thin Laravel adapters.