Download the PHP package othyn/filament-api-resources without Composer

On this page you can find all versions of the php package othyn/filament-api-resources. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package 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, 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

Exciting news: Over the weekend, the new Filament V4 Beta was released with official support for 'Tables with custom data', allowing API's to be used with "... supporting features like columns, sorting, searching, pagination, and actions."

Their documentation 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'.

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

Installation

Install the package via Composer:

Publish the configuration file:

Configuration

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

Add the following environment variables to your .env file:

Usage

1. Create an API Model

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

2. Create Filament Resource Pages

Use the provided base classes for your Filament resource pages:

List Page:

View Page:

3. Create Your Filament Resource

Create a standard Filament resource that uses your API model:

Important: When using API resources, you must add ->paginated(), and optionally ->deferLoading() to not block page loading on the API response, to your table configuration to ensure proper pagination and loading behavior. The pagination will automatically be forwarded to API calls.

Advanced Usage

Custom Response Structure

If your API uses a different response structure, you can customize it per model using dot notation:

Custom Headers per Request

You can add custom headers for specific requests:

Refreshing Data

In your view pages, you can refresh data from the API manually, in the case that you've performed some form of Livewire action on the page and wish to refresh the page state and repaint:

API Response Format

By default, the package expects your API to return responses in Laravel's standard paginated format:

This matches Laravel's default API resource pagination format. You can customize the response structure keys in the configuration file if your API uses a different format.

Pagination Query Parameters

When fetching paginated data, the package automatically sends the following query parameters to your API:

These parameter names can be customized in the configuration file:

Error Handling

The package includes built-in error handling for API requests. Failed requests will throw exceptions with detailed error messages. You can catch and handle these in your application as needed.

Debugging API Requests

When debugging API requests, Laravel's default behavior truncates request exception messages which can make it difficult to see the full API response. To get complete error details, you can disable request truncation in your bootstrap/app.php file:

This will ensure you see the complete API response in your logs and error messages, making debugging much easier.

Caching

API responses are automatically cached based on your configuration. You can:

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This package is open-sourced software licensed under the MIT license.


All versions of filament-api-resources with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
filament/filament Version ^3.0
illuminate/contracts Version ^10.0|^11.0|^12.0
illuminate/http Version ^10.0|^11.0|^12.0
illuminate/pagination Version ^10.0|^11.0|^12.0
illuminate/support Version ^10.0|^11.0|^12.0
livewire/livewire Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package othyn/filament-api-resources contains the following files

Loading the files please wait ...