Download the PHP package weckhawk/pretty-response without Composer
On this page you can find all versions of the php package weckhawk/pretty-response. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package pretty-response
Laravel API Response Builder
A fluent, expressive, and consistent API response wrapper for Laravel applications. It helps you standardize JSON responses, handle paginators automatically, and keep your controllers clean.
Features
- Standardized Structure: Ensures every JSON response follows a predictable format (
success,message,data,errors,meta). - Smart Pagination Handling: Automatically extracts metadata from Eloquent
LengthAwarePaginator,SimplePaginator, andCursorPaginator. - Resource Resolution: Seamlessly unwraps Laravel's
JsonResourceandResourceCollection. - Semantic Named Constructors: Clean static methods like
ApiResponse::success(),ApiResponse::validationError(), etc. - Global exception handling: Automatically converts
ValidationException,ModelNotFoundException,AuthenticationException,AuthorizationException, and any otherThrowableinto the same JSON envelope for requests that expect JSON — with a safe fallback for unhandled errors.
Installation
The service provider is auto-discovered. No manual registration is required.
Basic Usage
Success Response
Paginated Response
Pass any Laravel paginator directly into the success method. The package will automatically append the meta object:
Error Responses
Building a response from a caught exception
Useful when you want to convert an exception to an ApiResponse yourself, inside a try/catch, without relying on the global exception handler:
Attaching extra meta after the fact
withMeta() merges on top of any existing meta — including auto-detected paginator meta — without touching success, data, or errors.
Configuration
The global exception handler is registered automatically. If you'd rather handle exceptions yourself (e.g. only using ApiResponse::fromException() manually), disable it from your own AppServiceProvider::register():
Testing
Static analysis and code style checks:
Development & release workflow
dev— every push runs the full test matrix, PHPStan, and Pint.main— every pull request runs the same checks before it can be merged.- Releasing — from the Actions tab, run the Release workflow manually (it only runs against
main), enter the version (e.g.1.2.0). It re-runs the full quality gate against that exact commit and, only if everything passes, creates thevX.Y.Ztag and a GitHub Release. Packagist picks up the new tag automatically through its existing GitHub webhook — no extra step needed.
License
The MIT License (MIT). Please see License File for more information.
All versions of pretty-response with dependencies
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/pagination Version ^10.0|^11.0|^12.0|^13.0
illuminate/contracts Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0