api-endpoint

Create compliant Laravel API endpoints with controllers, requests, resources, routes, and tests.

66|10|Updated Aug 12, 2018
One-click install
npx skills add https://github.com/RaiderIO/keystone.guru --skill api-endpoint-raiderio
Or copy as Structured Prompt for Agentโ–ผ
Please help me install this Agent Skill.
Skill: api-endpoint
Source: https://github.com/RaiderIO/keystone.guru/tree/main/.claude/skills/api-endpoint
Command: npx skills add https://github.com/RaiderIO/keystone.guru --skill api-endpoint-raiderio

SYSTEM DOCUMENTATION & REQUIREMENTS

๐Ÿ’ก This Skill requires laravel, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill streamlines the process of creating new API endpoints, ensuring compliance with project standards and best practices.

Core Features & Use Cases

  • Compliant Endpoint Creation: Guides the user through creating new API routes, controllers, form requests, resources, and tests in a standardized manner.
  • Directory Layout: Provides a structured directory layout with examples for controllers, requests, resources, routes, and tests.
  • Form Request: Offers guidance on creating form requests with authorization, typed accessor methods, and validation rules.
  • Controller: Details how to create controllers with injected services and route model binding.
  • Route Registration: Explains how to register routes with prefix grouping and middleware considerations.
  • Resources: Outlines the creation of single and collection resources for API responses.
  • PHPUnit Test: Guides on writing tests for public and authenticated endpoints, including mocking service dependencies.
  • Checklist: Provides a step-by-step checklist for after writing files, including running tests, formatting, and staging changes.

Quick Start

Create a new API endpoint by following the directory layout guide and use the provided examples to write a controller, request, resource, and route.

Frequently Asked Questions about api-endpoint

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

FAQPage Schema
How do I create a new API endpoint in Laravel with controllers, requests, and resources?โ–ผ

Creating a Laravel API endpoint involves generating controllers, form requests, resources, and routes. This is automated by providing a structured directory layout and best-practice guidelines, ensuring endpoint creation follows project compliance standards efficiently.

What is the best way to structure Laravel API routes and controllers for compliance?โ–ผ

Structuring Laravel API routes and controllers for compliance involves using a standardized directory layout. Best practices include registering routes with prefix grouping and middleware, and building controllers with injected services and route model binding.

How do I write PHPUnit tests for Laravel API endpoints with mocked services?โ–ผ

Writing PHPUnit tests for Laravel API endpoints involves testing public and authenticated routes. You mock service dependencies within test cases to isolate endpoint behavior and verify API responses without triggering actual service logic.

Does this API endpoint generation approach work with standard Laravel framework dependencies?โ–ผ

Yes, this API endpoint generation approach works with standard Laravel framework dependencies. It requires Laravel and related PHP dependencies to automate the creation of compliant API functionality, including route model binding and form requests.

How do I set up Laravel form requests with validation rules and authorization?โ–ผ

Setting up Laravel form requests requires defining authorization logic, typed accessor methods, and validation rules. Using a standardized form request structure ensures data integrity and compliance before data reaches your controller logic.