api-error-handling

Community

Standardized PHP API errors with friendly UI.

Authorpeterbamuhigire
Version1.0.0
Installs0

System Documentation

What problem does it solve?

The Skill standardizes error responses for PHP REST APIs, ensuring consistent JSON envelopes and user-friendly messages across endpoints, validations, and backend failures.

Core Features & Use Cases

  • Standardized response envelope with machine-readable error codes and human-friendly messages.
  • Extracts precise error messages from PDOException variants and maps them to user-facing messages.
  • Robust HTTP status code mapping for validation, authentication, authorization, conflicts, and server issues.
  • Centralized logging with request IDs and secure production behavior (no stack traces).
  • Easy frontend integration with SweetAlert2-ready error payloads and front-end helper patterns.

Quick Start

Create a PHP REST endpoint that uses ApiResponse and ExceptionHandler to return structured JSON errors for validation, authentication, and server failures.

Dependency Matrix

Required Modules

None required

Components

references

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: api-error-handling
Download link: https://github.com/peterbamuhigire/skills-web-dev/archive/main.zip#api-error-handling

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.