mops1k/adr-bundle
mops1k/adr-bundle is a Symfony bundle for the Action-Domain-Responder pattern, separating request actions, domain logic, and response handling to keep controllers small and application code organized and maintainable.
The v0.0.2 release adds directory-based route loading for actions, which is the first feature worth evaluating. Start by requiring the package and publishing its config:
composer require <vendor>/<package>
php artisan vendor:publish --tag=<package>-config
Look first at the published config file—specifically the directory/path options and any namespace or middleware defaults. Then create a small Actions directory under app/ with one invokable action class. Register that directory in config and confirm the route appears with php artisan route:list.
A first use case: replace a handful of manual Route::get() calls with action classes that each expose their route definition (attribute, method, or convention). The package scans the directory, instantiates or reflects on each action, and registers routes. This is most useful for CRUD-style or domain-grouped actions where a directory maps cleanly to a route group.
Because this is v0.0.2, treat the API as unstable and pin the exact version in composer.json.
Directory-per-domain grouping. Point the package at app/Actions/Admin, app/Actions/Api, etc., and apply middleware/prefixes per directory in config. This keeps route registration close to the actions themselves.
Convention-based action discovery. Name action classes consistently (e.g., GetUsersAction, StoreUserAction) and let the package infer HTTP verbs and URIs from class names or a route() method. Keep the convention documented in your team’s README so new actions are predictable.
Attribute-driven routes. If the package supports PHP attributes on action classes, prefer them over a central route file. This makes each action self-contained and easy to move between directories without touching a separate route map.
Mixing with manual routes. Load directory routes inside the same route group as existing manual routes, but keep the directory scan last so explicit routes take precedence. Use Route::middleware() around the directory loader if the package exposes a registrar.
Module/package integration. For modular Laravel apps, register each module’s action directory from its service provider. This lets modules own their routes without editing routes/web.php.
Testing workflow. Use php artisan route:list after adding or moving an action. In tests, assert route registration with Route::getRoutes() or feature tests that hit the discovered URI. Clear route cache before running the suite if you cache routes in CI.
route:cache; if not, discovered routes may disappear in production. Always run php artisan route:clear after changing action directories.composer dump-autoload after adding a new namespace or moving directories.route:list -v to see the effective middleware stack.php artisan route:list, check the package’s config cache, and verify that action classes are not abstract or excluded by filename patterns.How can I help you explore Laravel packages today?