Download the PHP package enadstack/laravel-api-contracts without Composer
On this page you can find all versions of the php package enadstack/laravel-api-contracts. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download enadstack/laravel-api-contracts
More information about enadstack/laravel-api-contracts
Files in enadstack/laravel-api-contracts
Package laravel-api-contracts
Short Description Shared versioned commerce contracts for event schemas, API conventions, money DTOs, reference formats, error envelopes, pagination, and integration standards.
License MIT
Homepage https://github.com/Enadabuzaid/laravel-api-contracts
Informations about the package laravel-api-contracts
laravel-api-contracts
Shared versioned commerce contracts for event schemas, API conventions, money DTOs, reference formats, error envelopes, pagination, and integration standards — consumed by the independent Laravel microservices in this workspace.
Implementation Status
IN PROGRESS — Enadstack\ApiContracts\Http\Responses\ApiResponses (success/error/pagination response trait) and Enadstack\ApiContracts\Http\Exceptions\ApiExceptionRenderer (global exception normalization) are implemented and consumed by identity-access-service as the reference integration.
API Response Conventions
- Success with data stays flat — no
datawrapper — so each service's contracted field names (e.g.user,session) live at the top level:{"user": {...}, "session": {...}}. - Success, message only:
{"message": "..."}. - Error:
{"error": {"code": "SCREAMING_SNAKE_CASE", "message": "...", "details": {}}}—detailsis always a JSON object, never an array, even when empty. - Paginated success is the one place
datais used as a wrapper key, matching Laravel's own default paginated-resource shape:{"data": [...], "links": {...}, "meta": {...}}.
This means data is reserved specifically for array/paginated collections; single-object success responses stay flat. Don't "fix" this into wrapping everything in data.
Installation (local path repository)
In a consuming service's composer.json:
Then:
In bootstrap/app.php, inside ->withExceptions():
And in the service's base app/Http/Controllers/Controller.php:
All versions of laravel-api-contracts with dependencies
illuminate/support Version ^13.0
illuminate/http Version ^13.0
illuminate/pagination Version ^13.0