PHPackages                             othyn/filament-api-resources - 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. othyn/filament-api-resources

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

othyn/filament-api-resources
============================

A Laravel package that enables Filament to work seamlessly with API-backed resources instead of traditional Eloquent models

v1.1.1(10mo ago)0304MITPHPPHP ^8.4CI passing

Since Jun 23Pushed 10mo agoCompare

[ Source](https://github.com/othyn/filament-api-resources)[ Packagist](https://packagist.org/packages/othyn/filament-api-resources)[ GitHub Sponsors](https://github.com/othyn)[ RSS](/packages/othyn-filament-api-resources/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (9)Versions (7)Used By (0)

Filament API Resources
======================

[](#filament-api-resources)

A Laravel package that enables Filament to work seamlessly with API-backed resources instead of traditional Eloquent models. This package provides all the necessary components to build Filament admin panels that consume REST APIs. The standard approach is to reach for the superb package known as [Sushi](https://usesushi.dev/), but I've found that a bit limiting when it came to supporting the rest of Filaments feature suite, as well as pagination being an awkward solve. So with that in mind, I created this package.

Filament V4 Beta
----------------

[](#filament-v4-beta)

**Exciting news:** Over the weekend, the new Filament V4 Beta was released with official support for ['Tables with custom data'](https://filamentphp.com/content/leandrocfe-filament-v4-beta-feature-overview#tables-with-custom-data), allowing API's to be used with "... supporting features like columns, sorting, searching, pagination, and actions."

Their [documentation](https://filamentphp.com/docs/4.x/tables/custom-data) has extensive information on how to implement custom data now officially, including detailed documentation and extensive examples of ['Using an external API as a table data source'](https://filamentphp.com/docs/4.x/tables/custom-data#using-an-external-api-as-a-table-data-source).

I was mid way through initial development of this package, but I can't imagine it will be useful for much longer. So with that said, I'm not going to persue this further- so be warned, the code is a bit rough and ready in places. Glad to see upstream support for this use case, well done to the Filament team as always!

Features
--------

[](#features)

- 🚀 **API-First**: Built specifically for API-backed resources
- 🔄 **Livewire Integration**: Custom synthesizer for proper Livewire state management
- 📄 **Pagination Support**: Automatic pagination handling for API responses
- 💾 **Caching**: Built-in response caching with configurable TTL
- 🛠 **Flexible**: Configurable response structure and headers
- 🎯 **Filament Native**: Works with all standard Filament features (tables, forms, actions, etc.)

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

[](#installation)

Install the package via Composer:

```
composer require othyn/filament-api-resources
```

Publish the configuration file:

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

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

[](#configuration)

Configure your API settings in `config/filament-api-resources.php`:

```
return [
    'base_url' => env('FILAMENT_API_BASE_URL', 'https://api.example.com'),
    'default_headers' => [
        'Authorization' => 'Bearer ' . env('FILAMENT_API_TOKEN', ''),
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
    // ... more configuration options
];
```

Add the following environment variables to your `.env` file:

```
FILAMENT_API_BASE_URL=https://your-api.com/api
FILAMENT_API_TOKEN=your-api-token
```

Usage
-----

[](#usage)

### 1. Create an API Model

[](#1-create-an-api-model)

Extend the `BaseApiModel` class to create your API-backed models:

```
