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

ActiveLibrary[API Development](/categories/api)

gouravbajaj0210/api
===================

Easy API responses.

034PHP

Since Mar 21Pushed 7y agoCompare

[ Source](https://github.com/gouravbajaj0210/api_package)[ Packagist](https://packagist.org/packages/gouravbajaj0210/api)[ RSS](/packages/gouravbajaj0210-api/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Easy API response
=================

[](#easy-api-response)

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

[](#installation)

First, pull in the package through Composer.

```
"require": {
    "gouravbajaj0210/api": "dev-master"
},
  "repositories": [
    {
        "type": "git",
        "url": "https://gouravbajaj0210@bitbucket.org/gouravbajaj0210/api-package.git"
    }
    ],
```

And then, include the service provider within `config/app.php`.

```
'providers' => [
    gouravbajaj0210\api\ApiProvider::class
];
```

And, for convenience, add a facade alias to this same file at the bottom:

```
'aliases' => [
    'api' => gouravbajaj0210\api\ApiFacade::class
];
```

Publish the configurations by running this artisan command:

```
php artisan vendor:publish
```

Usage
-----

[](#usage)

- `api::success(['data'=>'random data'])`
- `api::notFound(['errorMsg'=> 'user not found'])`
- `api::notAuth(['errorMsg'=> 'user not authorized'])`
- `api::notValid(['errorMsg'=> 'email field is required'])`
- `api::serverError(['errorMsg'=> 'soemthing went wrong'])`

Alternatively, you may reference the `api()` helper function, instead of the facade. Here's an example:

```
api()->success(['data' => 'some data']);
api()->notFound(['errorMsg' => 'something nto found']);

```

Or, for a success API response, just do: `api(['data' => 'Some message']);`.

Method chaining
---------------

[](#method-chaining)

You can make use of method chaining:

```
#!php

api()->data(['data'=> 'my data'])->statusCode(201)->success();
api()->json()->notFound();

```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/63298b6542d8b875ebae2ef4a1acdb2975671d874dc1e4d041203fedd883e2d2?d=identicon)[gouravbajaj0210](/maintainers/gouravbajaj0210)

---

Top Contributors

[![gouravbajaj0210](https://avatars.githubusercontent.com/u/45494296?v=4)](https://github.com/gouravbajaj0210 "gouravbajaj0210 (3 commits)")

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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