← Zurück zu Team für Laravel und React
Entdecke, wie der Skill hilft
Idiomatische Laravel-Entwicklung
Nutzt vorhandene Laravel-Konventionen für klare Aufgaben von Validierung, Rechten, Fachlogik und HTTP-Verarbeitung.
laravel-conventions
Teammitglieder mit diesem Skill
Wann ist der Skill hilfreich?
Nutze diesen Skill für passende Erweiterungen ohne unnötige Architekturschichten.
Wobei hilft er dir?
- Hält Controller fokussiert und Fachregeln in der etablierten Schicht.
- Verwendet Dependency Injection und cachefähige Konfiguration.
- Folgt benannten Routen, ausdrücklichen Typen und einheitlichen Ausnahmen.
Das könntest du fragen
Implementiere Bestellstornierung mit unserem Action-Muster, Policy, Form Request und verständlicher Konfliktantwort. Versuche Stornierung vor und nach Versand. Bewahre Antwortformat und versandte Datensätze; liefere einen Konflikt, den der Aufrufer verständlich erklären kann.
Ausführliche Dokumentation
Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.
Weniger anzeigen
Idiomatic Laravel Development
Architecture and responsibilities
- Keep controllers focused on HTTP orchestration: receive a validated Form Request, authorize the action, delegate non-trivial business rules to the layer the project uses (domain methods, Action classes or Services), and return a response, View, Redirect or JsonResource.
- Separate input validation, authorization and business rules so each has one clear home and can run in HTTP, CLI and queue contexts.
- Do not introduce repositories, service layers or interfaces with a single implementation unless the project already uses that pattern or the complexity warrants it.
- Generate scaffolding with
php artisan make:*(--no-interaction) so namespaces and stubs match the app. Never edit files invendor/.
Container, config and environment
- Prefer constructor dependency injection and typed contracts over
app()service location in application code. Register bindings and singletons in Service Providers. - Call
env()ONLY insideconfig/*.php; in application code always readconfig('service.key')becauseenv()returnsnullwhen config is cached. Document new environment variables in.env.example.
Routing, errors and PHP style
- Use named routes (
route('orders.show', $order)), route model binding, andRoute::resource/Route::apiResourcewhere CRUD fits. - Use custom domain exceptions (
report()/render()or centralized exception handling inbootstrap/app.php/Handler.php) instead of catching generic\Exceptionand returning ad-hoc error arrays. - Add explicit parameter and return types, constructor property promotion, and PHP BackedEnums (
stringorint) for status/type sets. Format withvendor/bin/pint --dirtywhen Pint is present.
Enthaltene Dateien 2
LICENSE.txtSKILL.md
