Download the PHP package src83/laravel-api-response without Composer

On this page you can find all versions of the php package src83/laravel-api-response. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-api-response

Unified REST API Response formatter for Laravel

LaravelApiResponse is a Laravel package for building consistent and well-structured REST API JSON responses. Includes automatic exception handling, module-aware localization, structured logging, and pagination out of the box.

Tests Code Style Static Analysis Latest Stable Version

Available in other languages: RU


Table of contents


Introduction

Every Laravel API developer has hit the same wall: an exception fires, and instead of JSON your client gets a wall of HTML. laravel-api-response fixes that — and while it's at it, gives every response a consistent, predictable structure your frontend can always rely on.

Every response carries a structured message object with a machine-readable key and a human-readable gui string resolved from your translation files. Errors additionally include a sys field for internal context.

Success response example:

Error response example (including exceptions — always JSON, never HTML):

data and details are mutually exclusive — data and meta appears in success responses, details in errors. meta is null for simple responses and carries pagination data when the response is paginated.

Requirements

Versions
PHP 8.2 or higher
Laravel 9, 10, or 11

Installation

1. Require the package:

2. Run the installer:

The installer adds some things and modifies others in your existing project. You can review these targeted changes by running git status after executing the installation command.

In particular, pay close attention to Handler.php and Authenticate.php.

This package can be installed both on a fresh Laravel application and on an existing project with substantial business logic and a customized exception handler.

Depending on the project, the installer may behave differently (adaptively):

3. Verify the installation:

Confirms that all components have been installed correctly.
If anything shows ACTION REQUIRED, the installer detected existing custom logic in that file and did not overwrite it automatically.

In this case:

That's it — the package is installed and ready to use.
You can run php artisan api-response:check one more time to confirm, then get to the fun part.

Quick start

For a full reference — call signatures, response shapes, and pagination — see the docs/api-contract.md

Features

Design principles

Documentation

The essentials are covered in this README. Full documentation is in progress — for details, browse the inline code comments or open an issue.

License


All versions of laravel-api-response with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/http Version ^9.0|^10.0|^11.0
illuminate/support Version ^9.0|^10.0|^11.0
illuminate/log Version ^9.0|^10.0|^11.0
illuminate/pagination Version ^9.0|^10.0|^11.0
illuminate/validation Version ^9.0|^10.0|^11.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package src83/laravel-api-response contains the following files

Loading the files please wait ...