PHPackages                             yusufgenc/filament-api-forge - 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. yusufgenc/filament-api-forge

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

yusufgenc/filament-api-forge
============================

Automatically expose your Filament Resources as fully-featured REST APIs with authentication, documentation, rate limiting and query builder support.

1.2.0(1mo ago)14633↓35.6%MITPHP ^8.2

Since May 10Compare

[ Source](https://github.com/yusufgenc34/filament-api-forge)[ Packagist](https://packagist.org/packages/yusufgenc/filament-api-forge)[ Docs](https://github.com/yusufgenc34/filament-api-forge)[ RSS](/packages/yusufgenc-filament-api-forge/feed)WikiDiscussions Synced 3w ago

READMEChangelogDependencies (16)Versions (4)Used By (0)

Filament API Forge
==================

[](#filament-api-forge)

Automatically expose your **Filament Resources** as fully-featured REST APIs — with hash-based authentication, interactive OpenAPI documentation, per-resource access control, rate limiting, and IP restrictions. No Sanctum required.

[![Latest Version on Packagist](https://camo.githubusercontent.com/cd15dbc486ba5ab5966e8735f72be87c6fcad546c04d321fd9d3a39d0cdf6034/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f797573756667656e632f66696c616d656e742d6170692d666f7267652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/yusufgenc/filament-api-forge)[![PHP Version](https://camo.githubusercontent.com/6d0e63bb9482df87aa6c6ea983969a625be703cd8cfc3460c99eb1e582e6b46f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c75652e7376673f7374796c653d666c61742d737175617265)](https://www.php.net)[![Filament Version](https://camo.githubusercontent.com/3cec52582b7a0d59f8c03c3ed275b49c95dc2250cbb9667f951a9c7ad9254938/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f46696c616d656e742d352e782d6f72616e67652e7376673f7374796c653d666c61742d737175617265)](https://filamentphp.com)[![License](https://camo.githubusercontent.com/b774ebe1bd1476b30f54f7f938a0fcd66daea6ad05f06822c59422b583d3cdbd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f797573756667656e632f66696c616d656e742d6170692d666f7267652e7376673f7374796c653d666c61742d737175617265)](LICENSE)

---

Screenshots
-----------

[](#screenshots)

**Developer Center**[![Dashboard](screenshots/dashboard.png)](screenshots/dashboard.png)

**API Keys**[![API Keys](screenshots/api-keys.png)](screenshots/api-keys.png)

**API Docs**[![API Docs](screenshots/api-docs.png)](screenshots/api-docs.png)

**Access Control**[![Access Control](screenshots/access-control.png)](screenshots/access-control.png)

**Settings**[![Settings](screenshots/settings.png)](screenshots/settings.png)

**Public Docs — Light Mode**[![Public Docs Light](screenshots/public-docs-light.png)](screenshots/public-docs-light.png)

**Public Docs — Dark Mode**[![Public Docs Dark](screenshots/public-docs-dark.png)](screenshots/public-docs-dark.png)

---

Features
--------

[](#features)

FeatureDescription**Auto-Discovery**Detects any Resource implementing `HasApi` — zero manual route registration**Hash-Based Auth**`forge_` prefix tokens (SHA-256 hashed at rest), Stripe/OpenAI style**CRUD Endpoints**`index`, `show`, `store`, `update`, `destroy` — enable only what you need**Spatie Query Builder**Filtering, sorting, field selection, eager loading, full-text search out of the box**Scope Enforcement**Per-token `read` / `write` / `delete` scopes, plus `*` for full access**Access Control**Dedicated panel page — enable/disable methods or entire resources, set rate limits and IP rules**Rate Limiting**Global, per-resource, and per-method limits — method overrides resource, resource overrides global**IP Restrictions**Whitelist IPs per resource or per method (CIDR, wildcard, exact)**OpenAPI Docs**Dynamically generated OpenAPI 3.0 spec with interactive Swagger UI**Public Docs**Publish your API docs to a standalone public URL with a single click — light/dark mode included**Route Segment**Replace the panel ID in API paths with a custom segment (e.g. `/filament/posts`)**Request Counters**Per-token request count tracking with abbreviated display (1K, 2.4M) and one-click reset**Developer Center**Dashboard, API key management, documentation, access control, and settings — all in one panel group---

Requirements
------------

[](#requirements)

- PHP **8.2+**
- Laravel **12+**
- Filament **5.x**
- Spatie Laravel Query Builder **5+**

---

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

[](#installation)

```
composer require yusufgenc/filament-api-forge
```

Publish and run the migrations:

```
php artisan vendor:publish --tag="filament-api-forge-migrations"
php artisan migrate
```

Optionally publish the config file:

```
php artisan vendor:publish --tag="filament-api-forge-config"
```

---

Setup
-----

[](#setup)

### 1. Register the Plugin

[](#1-register-the-plugin)

Add `FilamentApiForgePlugin` to your panel provider:

```
use YusufGenc34\FilamentApiForge\FilamentApiForgePlugin;

public function panel(Panel $panel): Panel
{
    return $panel
        ->plugin(
            FilamentApiForgePlugin::make()
                ->apiKeys()     // API key management
                ->docs()        // API Docs + Access Control + Settings pages
                ->dashboard()   // Developer Center dashboard
        );
}
```

All three are enabled by default. You can disable any section:

```
FilamentApiForgePlugin::make()
    ->apiKeys()
    ->docs(false)       // hide docs, access control, and settings pages
    ->dashboard(false)  // hide the dashboard
```

### 2. Expose a Resource

[](#2-expose-a-resource)

Implement `HasApi` on any Filament Resource and define `apiConfig()`:

```
use YusufGenc34\FilamentApiForge\Contracts\HasApi;

class PostResource extends Resource implements HasApi
{
    public static function apiConfig(): array
    {
        return [
            'allowed_methods'   => ['index', 'show', 'store', 'update', 'destroy'],
            'allowed_filters'   => ['title', 'status', 'category_id'],
            'allowed_sorts'     => ['title', 'created_at', 'published_at'],
            'allowed_includes'  => ['author', 'category'],
            'allowed_fields'    => ['id', 'title', 'slug', 'body', 'status', 'published_at'],
            'searchable'        => ['title', 'body'],
            'scopes'            => ['read', 'write', 'delete'],
            'validation_rules'  => [
                'title'  => ['required', 'string', 'max:255'],
                'body'   => ['required', 'string'],
                'status' => ['required', 'in:draft,published,archived'],
            ],
        ];
    }
}
```

#### `apiConfig()` Reference

[](#apiconfig-reference)

KeyTypeDescription`allowed_methods``string[]`CRUD operations to expose: `index`, `show`, `store`, `update`, `destroy``allowed_filters``string[]`Columns clients can filter by (`?filter[title]=foo`)`allowed_sorts``string[]`Columns clients can sort by (`?sort=-created_at`)`allowed_includes``string[]`Eloquent relations to eager-load (`?include=author`)`allowed_fields``string[]`Columns clients can select (`?fields[posts]=id,title`)`searchable``string[]`Columns searched via `?search=query``scopes``string[]`Required token scopes: `read`, `write`, `delete``validation_rules``array`Explicit rules for `store`/`update`. Falls back to `allowed_fields` → `$fillable`### 3. Enrich the OpenAPI Docs (optional)

[](#3-enrich-the-openapi-docs-optional)

Decorate your Resource class with PHP 8 attributes to improve generated documentation:

```
use YusufGenc34\FilamentApiForge\Attributes\ApiTag;
use YusufGenc34\FilamentApiForge\Attributes\ApiDescription;
use YusufGenc34\FilamentApiForge\Attributes\ApiOperations;
use YusufGenc34\FilamentApiForge\Attributes\ApiIgnore;

#[ApiTag('Posts')]
#[ApiDescription('Manage blog posts and articles.')]
#[ApiOperations(
    index:   'List all posts with filtering and sorting',
    store:   ['summary' => 'Create a post', 'description' => 'Requires **write** scope.'],
    destroy: ['summary' => 'Delete a post', 'description' => 'Requires **delete** scope.'],
)]
class PostResource extends Resource implements HasApi { ... }
```

AttributeDescription`#[ApiTag('Name')]`Groups endpoints under a named tag in the OpenAPI spec`#[ApiDescription('...')]`Sets the resource description`#[ApiOperations(...)]`Per-method summaries and descriptions`#[ApiIgnore]`Excludes the resource from the spec entirely---

Authentication
--------------

[](#authentication)

All API requests must include a Bearer token:

```
curl -H "Authorization: Bearer forge_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
     https://yourapp.com/api/v1/admin/posts
```

### Token Format

[](#token-format)

Tokens use the `forge_` prefix followed by 40 random characters (238 bits of entropy). The plain-text token is shown **once** at creation — only its SHA-256 hash is stored.

### Scopes

[](#scopes)

ScopeAllowed operations`read``GET` (index, show)`write``POST`, `PUT`, `PATCH` (store, update)`delete``DELETE` (destroy)`*`Full accessTokens can also be restricted to specific resources via **Resource Access** in the API Keys page.

---

Making API Requests
-------------------

[](#making-api-requests)

The base URL pattern is:

```
{APP_URL}/api/v1/{segment}/{resource_slug}

```

Where `{segment}` is the panel ID (`admin`) by default, or a [custom route segment](#route-segment) if configured.

### Examples

[](#examples)

```
# List with filtering, sorting, and pagination
GET /api/v1/admin/posts?filter[status]=published&sort=-created_at&per_page=25

# Single record
GET /api/v1/admin/posts/1

# Create
POST /api/v1/admin/posts
Content-Type: application/json
{"title": "Hello World", "body": "...", "status": "draft"}

# Update
PUT /api/v1/admin/posts/1
Content-Type: application/json
{"status": "published"}

# Delete
DELETE /api/v1/admin/posts/1
```

### Query Parameters

[](#query-parameters)

ParameterExampleDescription`filter[field]``?filter[status]=published`Filter by field value (partial match)`sort``?sort=-created_at`Sort ascending or descending (prefix `-` for desc)`include``?include=author,category`Eager-load relations`fields[resource]``?fields[posts]=id,title`Sparse fieldsets`search``?search=laravel`Full-text search across `searchable` columns`per_page``?per_page=50`Results per page (capped by `max_per_page` config)---

Response Format
---------------

[](#response-format)

### Collection (`index`)

[](#collection-index)

```
{
  "data": [
    { "id": 1, "title": "Hello World", "status": "published" }
  ],
  "links": {
    "first": "/api/v1/admin/posts?page=1",
    "last":  "/api/v1/admin/posts?page=5",
    "prev":  null,
    "next":  "/api/v1/admin/posts?page=2"
  },
  "meta": {
    "current_page": 1,
    "last_page": 5,
    "per_page": 15,
    "total": 73,
    "api_version": "v1",
    "resource": "Posts"
  }
}
```

### Single record (`show` / `store` / `update`)

[](#single-record-show--store--update)

```
{
  "data": {
    "id": 1,
    "title": "Hello World",
    "status": "published",
    "created_at": "2026-01-01T00:00:00.000000Z"
  }
}
```

### Error responses

[](#error-responses)

Status`error` keyCause`401``unauthenticated`Missing or invalid token`403``insufficient_scope`Token lacks required scope`403``resource_not_allowed`Token restricted to other resources`403``ip_forbidden`Client IP is not whitelisted`404``not_found`Resource or record not found / disabled`405``method_not_allowed`Method is disabled for this resource`422`*(validation)*Request data failed validation`429``rate_limit_exceeded`Too many requests---

Developer Center
----------------

[](#developer-center)

The Developer Center is embedded in your Filament panel under the **Developer Center** navigation group.

PageURLDescription**Dashboard**`/admin/developer/dashboard`Stats overview (resources, endpoints, tokens, total requests with abbreviated counts), resource list, and quick-start examples**API Keys**`/admin/developer/api-keys`Create, inspect, and revoke tokens with scope and resource restrictions**API Docs**`/admin/developer/api-docs`Interactive OpenAPI documentation with try-it-out panel and Publish Docs button**Access Control**`/admin/developer/access-control`Enable/disable resources and individual methods; set rate limits and IP whitelists per resource or method**Settings**`/admin/developer/settings`Configure route segment, view route preview, and reset request counters---

Access Control
--------------

[](#access-control)

The **Access Control** page lets you manage per-resource settings without touching code.

- **Enable / Disable a Resource** — toggle the resource on or off. Disabled resources return `404`.
- **Enable / Disable Methods** — toggle specific HTTP methods. Disabled methods return `405`.
- **Rate Limiting** — set limits at resource or method level. Method limits override resource limits, which override the global config value.
- **IP Restrictions** — whitelist IPs at resource or method level. Supports exact IPs, CIDR ranges (`10.0.0.0/8`), and wildcards (`192.168.1.*`).

---

Public API Docs
---------------

[](#public-api-docs)

The **Publish Docs** button on the API Docs page makes your documentation available at a public URL — no login required:

```
GET /api/v1/docs

```

The page uses Swagger UI with full light/dark mode support (default light, toggle persisted in `localStorage`). When unpublished, the URL returns `403`.

The **Copy Public URL** button (visible when published) shows the URL in a notification for easy copying.

---

Route Segment
-------------

[](#route-segment)

By default, API paths include the Filament panel ID:

```
/api/v1/admin/posts

```

You can replace `admin` with any custom segment from **Developer Center → Settings**, or via environment variable:

```
API_FORGE_ROUTE_SEGMENT=filament
```

Result:

```
/api/v1/filament/posts

```

> **Note:** Both the original panel-ID paths and the new segment work simultaneously — no breaking changes to existing integrations.

The Settings page shows a live **Route Preview** table so you can see exactly how paths will appear in the docs before saving.

---

Request Counters
----------------

[](#request-counters)

Every API call increments the `request_count` on the token used. The Dashboard displays the all-time total with abbreviated formatting (`1.2K`, `3.5M`, `2.1B` — hover for exact value).

From **Settings → Request Counters** you can:

- See per-token counts (top 10 by usage, with last-used time)
- Reset all counters to zero with a single click (useful after testing or a new release)

---

Configuration
-------------

[](#configuration)

```
// config/filament-api-forge.php

return [
    'api_prefix'     => env('API_FORGE_PREFIX', 'api/v1'),
    'api_version'    => env('API_FORGE_VERSION', 'v1'),
    'rate_limit'     => env('API_FORGE_RATE_LIMIT', 60),  // global req/min

    // Custom URL segment to replace the panel ID in API paths
    // null = use panel ID (default)
    'route_segment'  => env('API_FORGE_ROUTE_SEGMENT', null),

    'auth' => [
        'enabled'                 => true,
        'default_expiration_days' => 365,
    ],

    'docs' => [
        'enabled'     => true,
        'title'       => 'API Documentation',
        'description' => 'Auto-generated API documentation for Filament resources.',
        'theme'       => 'dark',
    ],

    'discovery' => [
        'auto_discover'   => true,
        'allowed_methods' => ['index', 'show', 'store', 'update', 'destroy'],
        'middleware'      => ['api'],
    ],

    'pagination' => [
        'default_per_page' => 15,
        'max_per_page'     => 100,
    ],

    'query_builder' => [
        'enable_filters'  => true,
        'enable_sorts'    => true,
        'enable_includes' => true,
        'enable_fields'   => true,
    ],
];
```

---

License
-------

[](#license)

This package is open-sourced software licensed under the [MIT license](LICENSE).

---

Credits
-------

[](#credits)

Built by [Yusuf Genc](https://github.com/yusufgenc34).
Powered by [Filament](https://filamentphp.com) and [Spatie Laravel Query Builder](https://github.com/spatie/laravel-query-builder).

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance90

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity48

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 ~12 days

Total

3

Last Release

52d ago

### Community

Maintainers

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

---

Tags

apilaravelrestopenapiquery builderfilamentfilament-plugin

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/yusufgenc-filament-api-forge/health.svg)

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

###  Alternatives

[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.8k](/packages/rawilk-profile-filament-plugin)[croustibat/filament-jobs-monitor

Background Jobs monitoring like Horizon for all drivers for FilamentPHP

274333.4k9](/packages/croustibat-filament-jobs-monitor)[stephenjude/filament-jetstream

A Laravel starter kit built with Filament inspired by Jetstream.

17760.2k3](/packages/stephenjude-filament-jetstream)[stephenjude/filament-debugger

About

104162.2k2](/packages/stephenjude-filament-debugger)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[finity-labs/fin-mail

A powerful email template manager and composer for Filament with dynamic token replacement, template versioning, and inline email sending.

284.8k2](/packages/finity-labs-fin-mail)

PHPackages © 2026

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