samasend/laravel-make-scope
A Laravel package that adds a make:scope Artisan command to quickly scaffold reusable Eloquent query scopes, generating the class and wiring it into your models so you can keep query logic clean and DRY.
scopeXxx methods toward composable, single-responsibility query objects. Every generated scope class is a named, testable unit of business logic (ActiveSubscriptionScope, WithinSLAWindowScope), which is a prerequisite for domain modules, package extraction, or a future read-model/CQRS boundary.Consider it when:
require-dev dependency only — it is developer tooling, never runtime code, so blast radius on production is near zero.Look elsewhere or build in-house when:
public function scopeActive($q)) or a small internal make:scope command cover 90% of the value with zero dependency risk — which is most teams.For executives (30 seconds): This is a small, free, MIT-licensed developer tool that standardizes how our engineers write database queries. It costs nothing, touches no production code, and removes repetitive boilerplate so query logic stays consistent and reviewable across teams. The caveat is that the project is no longer maintained. So the recommendation is not "adopt this package" — it's "adopt this pattern," using the package's stubs as a template owned internally. Net cost: under a day of engineering. Net benefit: a durable internal convention instead of 30 competing ones.
For engineering leadership: Treat it as a template, not a dependency. Vendor the command and stubs into our own tooling repo under MIT attribution, add it to our lint/CI expectations, and we get the standardization benefit with no supply-chain or upgrade risk. If we do install it, it goes in require-dev, pinned, with a documented owner and a sunset trigger (the next Laravel major upgrade). Do not let it become load-bearing runtime infrastructure.
For the engineering team: One command generates a named, testable scope class; stubs are publishable so we control the shape. Use it to pay down query sprawl incrementally — one scope per PR, no big-bang refactor. Rule: scopes contain query intent only, no side effects, no business orchestration, and each ships with a test.
How can I help you explore Laravel packages today?