Download the PHP package i3rror/lapi-response without Composer

On this page you can find all versions of the php package i3rror/lapi-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 lapi-response

Laravel API Response

Latest Version GitHub repo size GitHub Packagist Downloads

Overview

LAPI-response is a comprehensive Laravel package that standardizes API responses across your application. It provides consistent response formatting, error handling, validation support, and pagination, making it easier to build robust APIs.

Features

Requirements

Dependencies

This package has been optimized to use the minimal set of Laravel components:

Core Dependencies

Optional Dependencies

The following packages are suggested for specific features:

When used within a Laravel application, these optional dependencies will be available through Laravel itself.

Installation

Step 1: Install via Composer

Step 2: Register Service Provider

Include the service provider in your config/app.php or in bootstrap/providers.php if you're using Laravel 11:

Step 3: Publish Configuration

Run the following command to publish the package configuration:

Basic Implementation

To use this package, add the APIResponseTrait to your controllers:

You have two implementation options:

  1. Global Implementation: Add the trait to App\Http\Controllers\Controller.php to make it available across all controllers
  2. Local Implementation: Add the trait only to specific controllers where API responses are needed

Helper Functions

Alternatively, you can use the package's global helper functions without adding the trait to your controllers. These functions can be used anywhere in your application:

These helper functions can be used as public functions or as internal helper functions within your application's codebase.

Usage Examples

Basic Response

Response:

Message Example:

Response:

Data Example:

Response:

Stream Response

The stream response feature allows you to handle large datasets efficiently:

Error Handling

Not Found Example

Response:

Bad Request Example

With Error Code

Available Status Types

Validation Support

If validation fails, it returns a standardized error response with validation errors.

Also we have a trait ready to use in case you're using FormRequests.

Pagination Support

The response includes pagination metadata with page information and navigation links.

Available Methods

All methods listed below are available both as trait methods and as global helper functions. You can use them either way depending on your implementation preference.

Create Response

Simplified Usage for apiResponse function

You can use short parameter values in two ways:

Response

Success Responses

Error Responses

Pagination and Validation

Other Utilities

Configuration

The package provides extensive configuration options in config/response.php:

Data Handling

Error Codes

Publishing Error Codes Enum

With custom class name:

Contributors

Contributors

Testing

This package includes a comprehensive test suite. To run the tests:

Test Coverage

The test suite covers:

License

The MIT License (MIT). Please see License File for more information.


All versions of lapi-response with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
illuminate/config Version >=10.43.0
illuminate/contracts Version >=10.43.0
illuminate/http Version >=10.43.0
illuminate/pagination Version >=10.43.0
illuminate/support Version >=10.43.0
illuminate/validation Version >=10.43.0
symfony/http-foundation Version ^6.4.41 || ^7.4.13 || ^8.1.0
psr/log Version ^3.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 i3rror/lapi-response contains the following files

Loading the files please wait ...