PHPackages                             johnvict/api-response - 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. johnvict/api-response

ActiveLibrary[API Development](/categories/api)

johnvict/api-response
=====================

API Response is a package that lets you send response in regular format, depending on the condition stated

v0.0.1(5y ago)144MITPHPPHP ^7.2

Since Oct 16Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Johnvict/api-response)[ Packagist](https://packagist.org/packages/johnvict/api-response)[ RSS](/packages/johnvict-api-response/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

API RESPONSE
============

[](#api-response)

API Response is a package that lets you send response in regular format, depending on the condition stated

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

[](#installation)

Use composer to install Error Format.

```
composer require johnvict/api-response
```

Usage
-----

[](#usage)

```
namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Johnvict\ApiResponse\Services\ApiResponse;

class ExampleController extends Controller
{
	/**
	 * Add the ApiResponse trait to your controller to enable the use of all availaable methods as part of the controller class
	 * Note: All reponses are sent with HTTP status code: 200
	 */
	use ApiResponse;

	// To return a successful message with status code "00" and message "Successful"
    public function success(Request $request) {
		$data = [
			"name" => "John Doe",
			"age" => 123,
			"username" => "big_daddy",
			"family" => [
				[
					"name" => "Vict Doe",
					"relationship" => "brother"
				],
				[
					"name" => "Mary Doe",
					"relationship" => "sister"
				],
			]
		];
		return self::returnSuccess($error);
	}

	// To return a response for a failed process message with status code: "02" custom error message
    public function customErrorMessage(Request $request) {
		/**
		 * some opertions occured and the request failed, so we need to send a custom message
		 * */
		$error = 'Some Error message';
		return self::returnFailed($error);
	}

	// To return a response for a failed process message with status code: "02" and default error message
	//Response will be sent with the default error message: "request failed"
    public function requestFailed(Request $request) {
		/**
		 * some opertions occured and the request failed
		 * */
		return self::returnFailed();
	}

}
```

Contributing
------------

[](#contributing)

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

License
-------

[](#license)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2040d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/35051689?v=4)[Oluwadamilola Johnvict Olamibo](/maintainers/Johnvict)[@Johnvict](https://github.com/Johnvict)

---

Top Contributors

[![Johnvict](https://avatars.githubusercontent.com/u/35051689?v=4)](https://github.com/Johnvict "Johnvict (2 commits)")

### Embed Badge

![Health badge](/badges/johnvict-api-response/health.svg)

```
[![Health](https://phpackages.com/badges/johnvict-api-response/health.svg)](https://phpackages.com/packages/johnvict-api-response)
```

###  Alternatives

[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[spatie/laravel-route-discovery

Auto register routes using PHP attributes

23645.0k2](/packages/spatie-laravel-route-discovery)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[didww/didww-api-3-php-sdk

PHP SDK for DIDWW API 3

1218.2k](/packages/didww-didww-api-3-php-sdk)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
