PHPackages                             mpokket/laravel-api-helper - 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. mpokket/laravel-api-helper

ActiveLibrary[API Development](/categories/api)

mpokket/laravel-api-helper
==========================

A set of API tools for Laravel projects

1.0.1(4y ago)05.4k1MITPHP

Since Jan 24Pushed 4y agoCompare

[ Source](https://github.com/mPokket/laravel-api-helper)[ Packagist](https://packagist.org/packages/mpokket/laravel-api-helper)[ RSS](/packages/mpokket-laravel-api-helper/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (3)Versions (3)Used By (0)

Laravel API Helper
==================

[](#laravel-api-helper)

A set of API tools for Laravel projects.

Installation
============

[](#installation)

Prerequisites
-------------

[](#prerequisites)

- PHP7.1+
- Laravel project

Install via composer to the Laravel project
-------------------------------------------

[](#install-via-composer-to-the-laravel-project)

- Run composer command

`composer require mpokket/laravel-api-helper`

- Register the Service Provider

In `config/app.php`, add the service provider to `$providers` array

```
'providers' => [
    ...
    Mpokket\APIHelper\APIHelperServiceProvider::class,
    ...
]
```

APIHelperServiceProvider
------------------------

[](#apihelperserviceprovider)

APIHelperServiceProvider provides **Mpokket\\APIHelper\\Annotations\\Deprecation** Annotation for your API methods which supports the following IETF RFCs,

- RFC8594 - **The Sunset HTTP Header Field**
- Internet Draft draft-dalal-deprecation-header-01 - **The Deprecation HTTP Header Field**

Usage
=====

[](#usage)

To add [Sunset](https://datatracker.ietf.org/doc/html/rfc8594) and [Deprecation](https://tools.ietf.org/id/draft-dalal-deprecation-header-01.html) for your APIs, use the following annotations over the API method directly.

Annotation options
------------------

[](#annotation-options)

```
/**
* @Deprecation(since=true) // If you don't know the date the API will deprecated on
* Deprecation annotation attributes
* since - true or the date and time (optional)
* sunset - Date and time (optional)
* alternate - URL for superseding API
* policy - URL for sunset policy
*/
```

### Example response header:

[](#example-response-header)

#### Example 1

[](#example-1)

Annotation

```
use Mpokket\APIHelper\Annotations\Deprecation; // DO NOT FORGET TO IMPORT THE ANNOTATION

/**
* Display a listing of the resource.
*
* @Deprecation(since="true") // or
* @Deprecation(since=true) // or
* @Deprecation(since="01-01-2023")
*
* @return \Illuminate\Http\Response
*/
public function index()
{
    return response('...');
}
```

```
Deprecation: true
```

#### Example 2

[](#example-2)

Annotation

```
use Mpokket\APIHelper\Annotations\Deprecation; // DO NOT FORGET TO IMPORT THE ANNOTATION

/**
* Display a listing of the resource.
*
* @Deprecation(since="31-12-2022", alternate=" https://domain.com/your/next/version/api",
*     policy="https://domain.com/api/deprecation/policy", sunset="01-01-2022")
*
* @return \Illuminate\Http\Response
*/
public function index()
{
    return response('...');
}
```

Response headers

```
Sunset: Mon, 01 Jan 2022 00:00:00 GMT
Deprecation: Mon, 31 Dec 2022 00:00:00 GMT
Link: https://domain.com/your/next/version/api; rel=alternate, https://domain.com/api/deprecation/policy; rel=deprecation
```

Notes
=====

[](#notes)

- [Deprecate](https://tools.ietf.org/id/draft-dalal-deprecation-header-01.html) header IETF proposal is currently in draft status
- PHPUnit tests are not done for testing deprecate middleware

Debug
=====

[](#debug)

On non-production environment, if there's any exception from the middleware, there will be a response header that points to the exception and line number. Use this while reporting issues along with your controller method annotation.

Support
=======

[](#support)

If you require any support, kindly use GitHub issue tracker for this project.

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

[](#contributing)

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

Please make sure to update tests as appropriate.

License
-------

[](#license)

[MIT](README.md)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

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

Every ~0 days

Total

2

Last Release

1620d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/110559811?v=4)[bhargav3](/maintainers/bhargav3)[@bhargav3](https://github.com/bhargav3)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mpokket-laravel-api-helper/health.svg)

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

###  Alternatives

[dingo/blueprint

API Blueprint documentation generator.

2707.8M23](/packages/dingo-blueprint)[darkaonline/swagger-lume

OpenApi or Swagger integration to Lumen

3362.4M3](/packages/darkaonline-swagger-lume)[oro/platform

Business Application Platform (BAP)

645143.5k114](/packages/oro-platform)[allure-framework/allure-php-api

Allure PHP commons

3611.3M7](/packages/allure-framework-allure-php-api)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k17](/packages/solspace-craft-freeform)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)

PHPackages © 2026

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