- How do I expose a Filament Resource as an API with this package?
- Add the `HasApi` trait to your Filament Resource class. The package auto-discovers it and generates REST endpoints (e.g., `/filament/api/posts`) for CRUD operations. No manual route or controller setup is required.
- Does this package work with Laravel Sanctum or Passport?
- No, it replaces Sanctum/Passport for API auth. It uses hash-based tokens (prefixed with `forge_`) stored securely in the database. This simplifies API key management for mobile apps or third-party services.
- Can I customize which CRUD methods are exposed for a resource?
- Yes. In your `HasApi` resource, override the `forgeApiMethods()` method to enable or disable `index`, `store`, `show`, `update`, or `destroy`. By default, all methods are enabled.
- How do I manage API keys and permissions in Filament?
- API keys are managed via a dedicated Filament panel page. You can create keys, assign scopes (`read`, `write`, `delete`), and enforce IP restrictions or rate limits per resource or method.
- What Laravel and Filament versions does this package support?
- It requires **Laravel 10+** and **Filament 5.x**. PHP 8.2+ is mandatory due to named arguments and attributes used internally. Check the [README](https://github.com/yusufgenc34/filament-api-forge) for exact version constraints.
- How does rate limiting work, and can I override defaults?
- Rate limiting is hierarchical: global limits apply first, then per-resource, and finally per-method overrides. Configure these in the Filament UI. For advanced use cases, you can extend the package’s throttling logic via service providers.
- Are the OpenAPI/Swagger docs interactive, and can I share them publicly?
- Yes, the package auto-generates an interactive Swagger UI for API docs. You can also publish a standalone public documentation page (light/dark mode) with a single click in the Filament settings.
- Can I restrict API access by IP address?
- Absolutely. Use the Filament UI to whitelist IPs per resource or method with CIDR notation, wildcards, or exact matches. This is useful for internal services or known client IPs.
- How do I handle complex queries like filtering, sorting, or eager loading?
- The package integrates with **Spatie’s Query Builder** for dynamic filtering, sorting, field selection, and eager loading. Use query parameters like `?filter[status]=active` or `?include=comments` in your API requests.
- What if I need to extend beyond REST (e.g., GraphQL or WebSockets)?
- This package focuses on REST APIs for Filament Resources. For GraphQL or WebSockets, you’d need to manually create additional routes or controllers. The package doesn’t block these extensions but prioritizes REST-first simplicity.