CommonPHP API is the JSON surface layer for CommonPHP applications. It mounts API routes, adapts HTTP requests into API requests, dispatches action handlers, normalizes action return values, and turns expected failures into JSON problem responses.
The package is deliberately small. HTTP primitives stay in comphp/http, route matching stays in comphp/router, and reusable input validation stays in comphp/validation.
Entry points:
CommonPHP\API\ApiSurfaceCommonPHP\API\ApiRequestCommonPHP\API\ApiResponseFactoryCommonPHP\API\ApiExceptionHandler
Response objects:
CommonPHP\API\JsonResponseCommonPHP\API\ApiProblemCommonPHP\API\ApiProblemResponse
Contracts:
CommonPHP\API\Contracts\ActionInterfaceCommonPHP\API\Contracts\AbstractActionCommonPHP\API\Contracts\ApiResponseInterface
Enums:
CommonPHP\API\Enums\ApiStatus
Exceptions:
CommonPHP\API\Exceptions\ApiExceptionCommonPHP\API\Exceptions\InvalidActionExceptionCommonPHP\API\Exceptions\UnsupportedContentTypeException