laravel-api-architect

Design Laravel APIs with a Service-Repository pattern and strict PHP 8.4 typing.

5|1|Updated Jan 22, 2026
One-click install
npx skills add https://github.com/anilcancakir/my-claude-code --skill laravel-api-architect
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: laravel-api-architect
Source: https://github.com/anilcancakir/my-claude-code/tree/main/skills/laravel-api-architect
Command: npx skills add https://github.com/anilcancakir/my-claude-code --skill laravel-api-architect

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Streamline and standardize Laravel API development by applying a service-repository pattern that reduces controller boilerplate, improves testability, and enforces consistent JSON responses and authentication.

Core Features & Use Cases

  • Thin Controllers that delegate to Services for business logic.
  • Service Layer to encapsulate business rules, transactions, and events.
  • Repository Layer for complex queries and data access abstraction.
  • API Resources for consistent response shaping and transformations.
  • Form Requests for centralized validation separate from controllers.
  • Built-in authentication support via Sanctum and Passport for token-based access.
  • Scenarios: standard CRUD APIs, mobile backends, admin dashboards, and microservice-oriented endpoints.

Quick Start

Create a Laravel API skeleton with routes/api.php, Api controllers, a Service, a Repository, FormRequests, Resources, and configure Sanctum or Passport for authentication to start developing endpoints.

Frequently Asked Questions about laravel-api-architect

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Laravel API with service and repository layers?

To structure a Laravel API with service and repository layers, use thin controllers that delegate business logic to services and data access to repositories. This pattern separates validation via FormRequests and responses via API Resources.

What is the best way to reduce boilerplate in Laravel API controllers?

The best way to reduce boilerplate in Laravel API controllers is by implementing a service-repository pattern. Controllers delegate business rules and complex queries to dedicated service and repository layers, improving testability and standardizing JSON output.

How do I set up Sanctum or Passport authentication for a Laravel API?

To set up Sanctum or Passport authentication for a Laravel API, configure your token-based access within routes/api.php. The service layer manages authentication logic for endpoints like login and register, ensuring consistent JSON responses.

Does Laravel service-repository architecture require strict PHP 8.4 typing?

Yes, this Laravel service-repository architecture requires strict PHP 8.4 typing. It enforces strict typing across thin controllers, service layers, and repositories to ensure robust API development and maintainable code.

When do I need a repository layer in my Laravel API?

You need a repository layer in your Laravel API when dealing with complex queries and data access abstraction. It works alongside the service layer, which handles business rules, transactions, and events for standard CRUD operations.

Can I use FormRequests and API Resources for Laravel API validation and responses?

Yes, you can use FormRequests for centralized validation separate from controllers and API Resources for consistent response shaping. This standardizes JSON output and transformations across all Laravel API endpoints.