PHPackages                             vahid/respond - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. vahid/respond

AbandonedArchivedLibrary[Parsing &amp; Serialization](/categories/parsing)

vahid/respond
=============

Easy JSON response for Laravel and Lumen, a useful package for handle your RESTful API endpoint

v1.0.5(4y ago)064MITPHPPHP &gt;=5.5

Since May 18Pushed 4y ago1 watchersCompare

[ Source](https://github.com/vahid-almasi/respond)[ Packagist](https://packagist.org/packages/vahid/respond)[ Docs](https://github.com/vahid-almasi)[ RSS](/packages/vahid-respond/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (5)Dependencies (4)Versions (21)Used By (0)

[![Build Status](https://camo.githubusercontent.com/cfd5d59268ad4ab6a455b028feaeda6a86098a3359ed9ec621045e2bf39b92a5/68747470733a2f2f6170702e7472617669732d63692e636f6d2f76616869642d616c6d6173692f726573706f6e642e7376673f6272616e63683d6d6173746572)](https://app.travis-ci.com/github/vahid-almasi/respond)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/4760c4849a80e0482f75258b1c980092cf45eec5d0d4649e6cd2529fabfc29db/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f76616869642d616c6d6173692f726573706f6e642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/vahid-almasi/respond/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/c94fd9c054443dc7ad4b03598356c9a0a7323bca3c45c26ed2e5985fb5a257d8/68747470733a2f2f706f7365722e707567782e6f72672f76616869642f726573706f6e642f762f737461626c65)](https://packagist.org/packages/vahid/respond)[![Total Downloads](https://camo.githubusercontent.com/06b7e1e8b2720f4e35e7397ba42824e7ea78e07fe4d029e26879a76ae1686936/68747470733a2f2f706f7365722e707567782e6f72672f76616869642f726573706f6e642f646f776e6c6f616473)](https://packagist.org/packages/vahid/respond)[![License](https://camo.githubusercontent.com/f73c88e7d4bb989c830f85631876d54c1ed86f0367eb5cc0fd442a9bd93ca815/68747470733a2f2f706f7365722e707567782e6f72672f76616869642f726573706f6e642f6c6963656e7365)](https://packagist.org/packages/vahid/respond)

Laravel Respond
===============

[](#laravel-respond)

This package is provided to be used on lumen and laravel framework v5 and upper and it gives clean methods to handle json response with specific predetermined messages.

Requirement
===========

[](#requirement)

- Laravel &gt;=5.1
- Lumen
- PHP &gt;=5.5

Install
-------

[](#install)

### Via Composer

[](#via-composer)

Go to your project path and run this code in your terminal

```
$ composer require vahid/respond
```

Or edit your composer.json to require the package.

```
"require": {
    "vahid/respond": "^1.0"
}
```

Then run `composer update` in your terminal to pull it in

Config
------

[](#config)

### Laravel

[](#laravel)

you will need to add the service provider to the providers array in your `config/app.php` as follows:

```
Vahid\Respond\RespondServiceProvider::class,
```

Next, also in the app.php config file, under the aliases array, you may want to add the Respond facade.

```
'Respond' => Vahid\Respond\Facades\Respond::class,
```

Laravel 4:

```
$ php artisan config:publish vahid/respond
```

Laravel 5:

```
$ php artisan vendor:publish --provider="Vahid\Respond\Providers\RespondServiceProvider"
```

### Lumen

[](#lumen)

#### Added into providers

[](#added-into-providers)

you will need to add the service provider beside another **register service providers** on `bootstrap/app.php` as follows:

```
$app->register(Vahid\Respond\RespondServiceProvider::class);
```

after that you need create a **helper** and add `config_path` function.

#### Create `config_path` helper for Lumen

[](#create-config_path-helper-for-lumen)

Create a file called GeneralHelpers.php in the app/Helpers directory. Paste the code inside it.

```
