PHPackages                             kodestudio/apiresponse - 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. kodestudio/apiresponse

ActiveLibrary[API Development](/categories/api)

kodestudio/apiresponse
======================

Package to generate a standard structure for api responses

151PHP

Since Dec 8Pushed 4y ago1 watchersCompare

[ Source](https://github.com/abbasnaumani/Kodestudio-ApiResponse)[ Packagist](https://packagist.org/packages/kodestudio/apiresponse)[ RSS](/packages/kodestudio-apiresponse/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Api Response Helper Functions
=============================

[](#api-response-helper-functions)

> This will provide Helper functions in laravel for API singleton approach to get responses

About
-----

[](#about)

The goal of this package is to provide you with a set of most common Responses that may be needed while developing JSON REST API. It also:

- Handles exceptions output.
- Singleton API response so single source of truth to get API responses

Installation
------------

[](#installation)

Created for Laravel 8, most probably will work for the older versions too by few tweaks if required.

```
composer require kodestudio/apiresponse
```

Add in providers array config/app.php before RouteServiceProvider

```
Kodestudio\ApiResponse\ApiResponseServiceProvider::class
```

Execute this to get configuration file at config/apiresponse.php

```
php artisan vendor:publish --tag=apiresponse-config
```

### Example:

[](#example)

Use ApiResponseTrait, where you want to use API responses

```
use ApiResponseTrait;

```

### Sample Integration Code:

[](#sample-integration-code)

```
