PHPackages                             vvinners/vapi - 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. vvinners/vapi

ActiveLibrary[API Development](/categories/api)

vvinners/vapi
=============

An enhanced version return response of API JSON. Aim to standardize the return api data format.

v2.1.0(3y ago)03.4k↓16.7%MITPHP

Since Nov 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/vvinners/vapi)[ Packagist](https://packagist.org/packages/vvinners/vapi)[ RSS](/packages/vvinners-vapi/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)DependenciesVersions (8)Used By (0)

VAPI - Standardize the format of API return
===========================================

[](#vapi---standardize-the-format-of-api-return)

\###\[IMPORTANT\] V2 of VAPI has breaking changes, should remove msgcode.php from config folder and publish the config file

Table of Contents
-----------------

[](#table-of-contents)

- [Contribution](#contribution)
- [Installation](#installation)
- [Demo](#demo)
- \[V2\] (#v2)
- [License](#license)

Contribution
------------

[](#contribution)

Contributions are what make such an amazing community and project. Learn, inspire, and create between each other. Any contributions you make are **greatly appreciated**.

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

[](#installation)

```
composer require vvinners/vapi
```

Publish config file to app/config

```
php artisan vendor:publish --provider="VVinners\Vapi\VapiServiceProvider" --tag=config
```

Put this to config/app.php if the package is not auto discovered ```
VVinners\Vapi\VapiServiceProvider::class
```

Demo
----

[](#demo)

```
use VVinners\Vapi\Api;

$api = new Api;
return $api->response(["result" => true], "OK");
```

The code above will convert the data to this **JSON format** and return in **HTTP 200 status**

```
{msg_code: "OK", msg: "Success", result: true}
```

the second parameter **"OK"** can be updated at the msgcode.php below is an example data of the file

```
