- Do I need the Verbs event sourcing package installed before using hirethunk/verbs-commands?
- Yes. This package is a satellite of hirethunk/verbs and only adds a command bus for the write side of an existing Verbs application; it has no standalone capability. If you are not already committed to Verbs with its aggregates, projections, reactors, and event store, this package adds nothing and should be skipped. Adopt and evaluate Verbs core first, then layer this on top.
- How do I install hirethunk/verbs-commands in a Laravel app?
- It is Composer-native, so composer require hirethunk/verbs-commands is essentially the whole integration alongside Verbs itself. It introduces no new runtime, datastore, or infrastructure dependency beyond what Verbs already requires. Because the package has a single release and no dependents, pin an explicit version instead of floating on a caret constraint, and validate it against your Laravel and PHP matrix before merging.
- Which Laravel and PHP versions does hirethunk/verbs-commands support?
- The package's Composer constraints are the authoritative answer and should be checked against your pinned runtime before adoption. With one release from June 2024 and no downstream consumers, there is no dependents base to surface breakage when Laravel ships a major bump. Run a contained spike on your target Laravel major and PHP minor rather than assuming compatibility from the metadata.
- How do I generate a new command and its handler?
- A single Artisan call scaffolds both the command class and its handler, so you do not hand-write the pairing or the directory structure. Check the package README for the exact generator signature and available flags in your pinned version. After that you dispatch the typed command object instead of calling domain logic directly from controllers or queued jobs.
- How are command handlers bound to commands and resolved?
- Handlers are bound to commands declaratively with attributes and discovered automatically, so there is no manual registry to keep in sync. At dispatch time the command is resolved to its handler through the Laravel container, which means normal constructor injection works inside handlers. That keeps controllers and jobs thin and makes the write-side intent explicit in your domain code.
- How do I fake and assert commands in Laravel feature tests?
- The package supports testable dispatch: you can fake the command bus and assert which commands were dispatched, in the same spirit as Laravel's event and job fakes. That lets feature tests assert write-side intent without executing handlers or touching the event store. Pair it with Verbs' own aggregate and projection tests to cover the full flow.
- Can I wrap command execution in validation, transactions, or authorization?
- Yes. Dispatch runs through a middleware pipeline, which is the intended place for validation, database transactions, and authorization checks. Wrapping a command in a transaction is a common pattern so the aggregate write and its events commit atomically. Keeping these cross-cutting concerns in middleware stops them leaking into individual handlers.
- Is hirethunk/verbs-commands actively maintained and safe for production?
- Be cautious: the metadata shows a single release in June 2024, roughly one star, zero dependents, and no visible evidence of a test suite or CI. That is effectively no external validation, and a thin Laravel package is usually the first thing to break on a framework major bump. If you adopt it, assume you own it: pin the version, add it to your dependency-review checklist, and name an internal owner.
- How is this different from Verbs core, and what are the alternatives?
- Verbs core covers the event-sourced read side such as aggregates, projections, reactors, and the event store, while this package adds a structured command bus for the write side. The surface area it adds over Verbs' native command handling appears small enough that reimplementing the pattern in-house may take hours rather than weeks. That in-house option, or vendoring a pinned copy, removes the upstream maintenance tail entirely.
- Can I fork or vendor hirethunk/verbs-commands internally?
- Yes. It is MIT licensed, so a private fork and internal redistribution are permitted. Given the low release cadence and lack of downstream users, vendoring a pinned copy or forking is a sensible hedge against upstream abandonment. Make the fork, vendor, or depend-upstream decision at an explicit checkpoint before any production code relies on the package.