PHPackages                             datakrama/lapires - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. datakrama/lapires

ActiveLibrary[API Development](/categories/api)

datakrama/lapires
=================

Lapires - Laravel API Response, generalizing all response from your API server

v2.1.0(5y ago)13.1k1MITPHPPHP ^7.2|^8.0CI failing

Since Jun 7Pushed 5y agoCompare

[ Source](https://github.com/datakrama/lapires)[ Packagist](https://packagist.org/packages/datakrama/lapires)[ RSS](/packages/datakrama-lapires/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (8)Dependencies (5)Versions (11)Used By (1)

Lapires - Laravel API Response
------------------------------

[](#lapires---laravel-api-response)

[![GitHub Workflow Status (branch)](https://camo.githubusercontent.com/a6653125dc68dca0b3eca0cd3eac532c93e979bc2b8a1b68b5a1d2dfa9019c6a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f646174616b72616d612f6c6170697265732f43493f6c6162656c3d4349267374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/a6653125dc68dca0b3eca0cd3eac532c93e979bc2b8a1b68b5a1d2dfa9019c6a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f646174616b72616d612f6c6170697265732f43493f6c6162656c3d4349267374796c653d666c61742d737175617265) [![Packagist Version](https://camo.githubusercontent.com/8442f8a76d6bde302223c0bee8a2984e3e615ac16076c8b04f1fc3e870c9f1b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646174616b72616d612f6c6170697265733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/8442f8a76d6bde302223c0bee8a2984e3e615ac16076c8b04f1fc3e870c9f1b2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f646174616b72616d612f6c6170697265733f7374796c653d666c61742d737175617265) [![Packagist Downloads](https://camo.githubusercontent.com/151e51143f6f37e07628ae7608280892cd20cbfb594a552c802709b1a9e239fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f646174616b72616d612f6c6170697265733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/151e51143f6f37e07628ae7608280892cd20cbfb594a552c802709b1a9e239fe/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f646174616b72616d612f6c6170697265733f7374796c653d666c61742d737175617265) [![Packagist License](https://camo.githubusercontent.com/403533a024e4a7360987156fcea79dd0cacd76bf10570a7a047202f3a3ccf2f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f646174616b72616d612f6c6170697265733f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/403533a024e4a7360987156fcea79dd0cacd76bf10570a7a047202f3a3ccf2f3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f646174616b72616d612f6c6170697265733f7374796c653d666c61742d737175617265)

Lapires is simple [Laravel](https://github.com/laravel/laravel "Laravel") package for generalizing all default response to API-friendly response. With this package, you will have a properly formatted JSON response. However, the response format is fixed, you can not change the format.

Requirements
------------

[](#requirements)

- [Laravel 7.x|8.x](https://github.com/laravel/laravel)

Laravel Compatibility
---------------------

[](#laravel-compatibility)

LaravelPackage[6.x](https://laravel.com/docs/6.x)[1.x](https://github.com/datakrama/lapires/tree/v1)[7.x](https://laravel.com/docs/7.x)[2.x](https://github.com/datakrama/lapires/tree/v2)[8.x](https://laravel.com/docs/8.x)[2.x](https://github.com/datakrama/lapires/tree/v2)Installation
------------

[](#installation)

`$ composer require datakrama/lapires:"^2.0"`

Config (Optional)
-----------------

[](#config-optional)

If you need to disable custom exception response from this package, publish the config file, and change `exception` option to `false`.

`$ php artisan vendor:publish --provider="Datakrama\Lapires\LapiresServiceProvider"`

Usages
------

[](#usages)

All responses will be formatted as follows:

```
// Success response

{
    "success": true,
    "message": ...,
    "data": {
        ...
    }
}

```

```
// Error response

{
    "success": false,
    "message": ...,
    "errors": {
        ...
    }
}

```

### General

[](#general)

```
