symfony-sk:api-action

Create API action controllers extending BaseAction for standardized JSON endpoints.

Updated Jan 15, 2026
One-click install
npx skills add https://github.com/Swoking/symfony-sk-plugin --skill symfony-sk-api-action
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: symfony-sk:api-action
Source: https://github.com/Swoking/symfony-sk-plugin/tree/main/plugins/symfony-sk/skills/api-action
Command: npx skills add https://github.com/Swoking/symfony-sk-plugin --skill symfony-sk-api-action

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create API action controllers that extend BaseAction to standardize API endpoints.

Core Features & Use Cases

  • Extends BaseAction for consistent behavior across controllers.
  • Routes start with /{lang}/ and pass language to services.
  • Handles HTTP requests, optional DTO validation, and JSON responses.

Quick Start

Extend BaseAction to create an API action, wire a /{lang}/ route, and return a standardized JSON response.

Frequently Asked Questions about symfony-sk:api-action

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

FAQPage Schema
How do I standardize JSON API responses in Symfony controllers?

To standardize JSON API responses in Symfony, extend BaseAction to handle HTTP requests uniformly and return JSON results via processReturnCode, ensuring consistent behavior across all controllers.

How do I enforce a language-specific route prefix like /{lang}/ in Symfony?

To enforce a language-specific route prefix like /{lang}/ in Symfony, extend BaseAction. It automatically enforces this route pattern and always passes the extracted $lang parameter to your underlying services.

How do I handle DTO validation before returning a JSON response in Symfony?

Handle DTO validation in Symfony by routing requests through a BaseAction controller, which processes incoming HTTP requests, validates optional DTOs, and returns standardized JSON responses upon success or failure.

Can I use BaseAction to standardize API endpoints without writing custom boilerplate?

Yes, you can use BaseAction to standardize API endpoints without custom boilerplate. It manages routing patterns, language parameter injection, and response formatting automatically for consistent API behavior.

What is the best way to pass a language parameter to services in Symfony API routes?

The best way to pass a language parameter to services in Symfony API routes is using BaseAction. It enforces routes starting with /{lang}/ and automatically passes the $lang parameter directly to your service layer.