yusufgenc/filament-api-forge
Expose Filament Resources as REST APIs automatically—no Sanctum. Hash-based API keys with scopes, per-resource access control, rate limiting, IP restrictions, Spatie Query Builder filtering/sorting, and auto-generated OpenAPI + public Swagger docs.
Automatically turn your Filament Resources into fully-featured, secure, and documented REST and GraphQL APIs with zero route boilerplate.
| Developer Center | API Keys |
|---|---|
![]() |
![]() |
| Interactive OpenAPI Docs | Access Control |
|---|---|
![]() |
![]() |
| Settings | Webhooks |
|---|---|
![]() |
![]() |
| Public Documentation |
|---|
![]() |
Building APIs for Laravel apps often requires writing redundant controllers, form requests, policies, and Swagger documentation for every model. Filament API Forge eliminates this boilerplate by extending Filament's Server-Driven UI concept straight to your API layer.
Simply implement HasApi on any Filament Resource and get an instant REST (and optional GraphQL) API with token authentication, rate limiting, IP protection, policy enforcement, and live Swagger documentation.
| Feature | Description | Reference |
|---|---|---|
| Auto-Discovery | Detects resources implementing HasApi with zero route registration |
Exposing Resources |
| Hash-Based Auth | forge_ tokens hashed at rest (SHA-256) — no Sanctum required |
Authentication |
| Policy Authorization | Automatic Laravel Model Policy integration (Gate::authorize) |
Policies |
| Spatie Query Builder | Filtering, sorting, sparse fieldsets, relation includes out of the box | Query Building |
| Custom Eloquent Resources | Use custom JsonResource classes per resource |
Custom Formatting |
| Relation Syncing | Auto-sync BelongsToMany and MorphToMany relations on write |
Relation Syncing |
| Batch Operations | Bulk create, update, delete, restore, and forceDelete in one request |
Batch Operations |
| File Uploads | Multipart form data uploads for Filesystem & Spatie Media Library | File Uploads |
| OpenAPI & Public Docs | Auto-generated OpenAPI 3.0 specs with interactive Swagger UI | Documentation |
| Developer Center | Panel pages for API Key Management, Settings, Logs & Access Control | Panel Pages |
composer require yusufgenc/filament-api-forge
php artisan vendor:publish --tag="filament-api-forge-migrations"
php artisan migrate
use YusufGenc34\FilamentApiForge\FilamentApiForgePlugin;
public function panel(Panel $panel): Panel
{
return $panel
->plugin(FilamentApiForgePlugin::make());
}
Implement HasApi on your Filament Resource and add 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'],
'allowed_sorts' => ['created_at'],
'use_policies' => true,
'validation_rules' => [
'title' => ['required', 'string', 'max:255'],
],
];
}
}
Your API endpoint is ready at /api/v1/admin/posts.
For comprehensive documentation covering Hooks, Uploads, Custom Actions, Nested Resources, GraphQL, Webhooks, Multi-Tenancy, and API Versioning, see DOCS.md.
Contributions are welcome! Whether it is fixing a bug, improving documentation, or proposing a new feature, your help is appreciated.
composer install
./vendor/bin/pest
vendor/bin/pint
Please ensure all tests pass and new features include test coverage.
If you discover a security vulnerability within Filament API Forge, please send an issue or email to the maintainers. All security vulnerabilities will be promptly addressed.
If you find this package useful, please consider giving it a star on GitHub to support its development!
Created and maintained by Yusuf Genc.
The MIT License (MIT). Please see License File for more information.
How can I help you explore Laravel packages today?