PHPackages                             mohamedhekal/apiforge - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. mohamedhekal/apiforge

ActiveLibrary[HTTP &amp; Networking](/categories/http)

mohamedhekal/apiforge
=====================

Laravel API kit: version negotiation, JSON envelopes, consistent error rendering, and route helpers

v0.1.0(1mo ago)00MITPHPPHP ^8.2CI passing

Since Jul 16Pushed 1mo agoCompare

[ Source](https://github.com/mohamedhekal/apiforge)[ Packagist](https://packagist.org/packages/mohamedhekal/apiforge)[ Docs](https://github.com/mohamedhekal/apiforge)[ RSS](/packages/mohamedhekal-apiforge/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (10)Versions (2)Used By (0)

ApiForge
========

[](#apiforge)

[![CI](https://github.com/mohamedhekal/apiforge/actions/workflows/tests.yml/badge.svg)](https://github.com/mohamedhekal/apiforge/actions)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/c2588b5670f2c910b8cc849ace22a22efda8956b7c2f797d11d2096bbfc7b1f5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d3737374242342e737667)](https://www.php.net/)[![Laravel](https://camo.githubusercontent.com/b38aa2ff655206bfa9f97c1aeced06f25bb3e31fb085fa974c79934c25469f41/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d313125324631322d4646324432302e737667)](https://laravel.com/)

**Search terms:** laravel, api, versioning, json, errors, rest, php, laravel-package, rest-api, api-errors, json-api.

Laravel API kit: version negotiation, JSON success/error envelopes, exception rendering, and `Route::apiVersion()` helpers.

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

[](#installation)

```
composer require mohamedhekal/apiforge
php artisan vendor:publish --tag=apiforge-config
```

Versioned routes
----------------

[](#versioned-routes)

```
use Hekal\ApiForge\Facades\ApiForge;
use Illuminate\Support\Facades\Route;

Route::apiVersion('v1', function () {
    Route::get('/orders', fn () => ApiForge::ok(['orders' => []]));
});
// GET /api/v1/orders
```

Middleware aliases: `apiforge.version`, `apiforge.json`.

Version can also come from `X-API-Version` or `Accept: application/vnd.apiforge.v1+json`.

Envelopes
---------

[](#envelopes)

```
{
  "data": { "id": 1 },
  "error": null,
  "meta": { "version": "v1", "request_id": "..." }
}
```

```
ApiForge::fail('Out of stock', 'out_of_stock', 409, ['sku' => 'A1']);
throw new \Hekal\ApiForge\Exceptions\ApiException('Nope', 'conflict', 409);
```

Validation / auth / 404 exceptions under API routes render into the same shape.

Composition
-----------

[](#composition)

Pair with `mohamedhekal/oncegate` for Idempotency-Key on mutating routes. Rate limiting stays Laravel’s `throttle` middleware.

Limitations (v0.1)
------------------

[](#limitations-v01)

- No OpenAPI generator yet
- Does not replace Form Requests or API Resources—use them inside controllers as usual
- Unsupported requested versions fall back to default (not 406)

Testing
-------

[](#testing)

```
composer install && composer test
```

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 74% of packages

Maintenance90

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

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

45d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9d7c092a109fe780c7efd87ce4142eae2c0cec0f92fd1e87e769bec5661953b?d=identicon)[mohamedhekal](/maintainers/mohamedhekal)

---

Top Contributors

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

---

Tags

apijsonlaravellaravel-packagephprest-apiphpjsonapilaravelrestlaravel-packageerrorsversioningREST APIJSON-APIapi-errors

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/mohamedhekal-apiforge/health.svg)

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

###  Alternatives

[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

80732.6M270](/packages/laravel-mcp)[psalm/plugin-laravel

Psalm plugin for Laravel

3365.5M359](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58190.1k22](/packages/api-platform-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k31.8M166](/packages/laravel-cashier)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k12.6M131](/packages/nuwave-lighthouse)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k17.6M165](/packages/laravel-pulse)

PHPackages © 2026

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