PHPackages                             thuraaung2493/laravel-api-helpers - 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. thuraaung2493/laravel-api-helpers

ActiveLibrary

thuraaung2493/laravel-api-helpers
=================================

A simple package for creating API endpoints with Laravel.

035↓100%PHP

Since Sep 10Pushed 3w ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

Laravel API Helpers
===================

[](#laravel-api-helpers)

**It supports Laravel 9+ and PHP 8.1+**

Description
-----------

[](#description)

This package contains many utility classes that assist in API creation.

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

[](#installation)

### Laravel

[](#laravel)

Require this package with composer using the following command:

```
composer require thuraaung2493/laravel-api-helpers@dev
```

Usage
-----

[](#usage)

### Helper Classes for Json API Responses

[](#helper-classes-for-json-api-responses)

**All API Response classes implement the Responsable interface.**

ClassDescriptionThuraaung\\ApiHelpers\\Http\\Responses\\ModelResponse::classIt returns json response for **JsonResource**.Thuraaung\\ApiHelpers\\Http\\Responses\\CollectionResponse::classIt returns json response for **CollectionResource**.Thuraaung\\ApiHelpers\\Http\\Responses\\PaginatedResponse::classIt returns json response for **PaginationResource**.Thuraaung\\ApiHelpers\\Http\\Responses\\MessageResponse::classIt returns json response for **Message**.Thuraaung\\ApiHelpers\\Http\\Responses\\TokenResponse::classIt returns json response for **Token**.Thuraaung\\ApiHelpers\\Http\\Responses\\ApiErrorResponse::classIt returns json response for **Errors**.Thuraaung\\ApiHelpers\\Http\\Responses\\ApiValidationErrorsResponses::classIt returns json response for **Validations**.*Response Formats* see in [responses.json](https://github.com/thuraaung2493/laravel-api-helpers/blob/main/responses.json)

```
// Response Format for ModelResponse|CollectionResponse|MessageResponse|TokenResponse
{
    "data": "",
    "message": "Success.",
    "status": 200
}
// Response Format for ApiErrorResponse
{
    "title": "Error!",
    "description": "Error Description",
    "status": 500
}
// Response Format for ApiValidationErrorsResponse
{
    "title": "Error!",
    "errors": [],
    "status": 422
}
```

### Middleware Classes

[](#middleware-classes)

ClassDescriptionThuraaung\\ApiHelpers\\Http\\Middleware\\GzipEncodingResponse::classIt is used to apply Gzip encoding to API responses.Thuraaung\\ApiHelpers\\Http\\Middleware\\JsonApiResponse::classIt is used to apply default headers to API responses.To change default headers in config

```
php artisan vendor:publish --tab=api-helpers
```

### DataObjects

[](#dataobjects)

ClassDescriptionThuraaung\\ApiHelpers\\DataObjects\\Header::classHeader Data Object.Thuraaung\\ApiHelpers\\DataObjects\\Http\\Headers\\Accept::classAccept Header Data Object.Thuraaung\\ApiHelpers\\DataObjects\\Http\\Headers\\AcceptEncoding::classAccept Encoding Header Data Object.Thuraaung\\ApiHelpers\\DataObjects\\Http\\Headers\\ContentEncoding::classContent Encoding Header Data Object.Thuraaung\\ApiHelpers\\DataObjects\\Http\\Headers\\ContentLength::classContent Length Header Data Object.Thuraaung\\ApiHelpers\\DataObjects\\Http\\Headers\\ContentType::classContent Type Header Data Object.*Example*

```
  $accept = Accept::of(
    type: ContentType::JSON
  );

  // Turn to Header
  $accept->asHeader();
  // new Header(
  //   key: 'Accept',
  //   value: 'application/json',
  // );

  // Turn to headers array
  $accept->headers();
  // [
  //   'Accept' => 'application/json',
  // ]
```

### Enums

[](#enums)

ClassDescriptionThuraaung\\ApiHelpers\\Http\\Enums\\Status::classHTTP Status.Thuraaung\\ApiHelpers\\Http\\Enums\\Scheme::classScheme.Thuraaung\\ApiHelpers\\Http\\Enums\\Methods::classRequest Methods.Thuraaung\\ApiHelpers\\Http\\Enums\\Headers\\Connection::classConnection Headers.Thuraaung\\ApiHelpers\\Http\\Enums\\Headers\\ContentEncoding::classContent Encoding Headers.Thuraaung\\ApiHelpers\\Http\\Enums\\Headers\\ContentType::classContent Type Headers.

###  Health Score

26

↑

LowBetter than 46% of packages

Maintenance62

Regular maintenance activity

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity22

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6764acf86f328588b8b35a2e03683a19f42ed37d11dddb582256743c467d318f?d=identicon)[thuraaung2493](/maintainers/thuraaung2493)

---

Top Contributors

[![thuraaung2493](https://avatars.githubusercontent.com/u/22706964?v=4)](https://github.com/thuraaung2493 "thuraaung2493 (16 commits)")

### Embed Badge

![Health badge](/badges/thuraaung2493-laravel-api-helpers/health.svg)

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

PHPackages © 2026

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