Skip to content

Compared to API Platform ​

API Platform is the reference API framework in PHP, and since its version 4 it runs on Laravel too. It solves the same problem as this package, a complete REST API over your models, in a very different way. This page sets the two side by side so you can pick the one that fits your project.

Two approaches ​

With API Platform, you add the #[ApiResource] attribute to an Eloquent model and the API exists. API Platform registers the routes and answers every request through its own controller, state providers and processors, at runtime. Your repository holds the models and their attributes, and api-platform/laravel stays a production dependency.

The generator writes the code instead. Each entity gets a controller, a service, a DTO, two form requests, a resource, a policy, a migration, a factory, a seeder and two test classes, all plain Laravel. The package is a dev dependency, and nothing it generates refers to it, so the API keeps working once it is removed.

Side by side ​

API Platform for LaravelLaravel API Generator
How the API exists#[ApiResource] on a model, served at runtime by API PlatformControllers, services and the rest written into your project
Dependencyapi-platform/laravel in production--dev, removable once the code is generated
FormatsJSON-LD (Hydra), JSON:API, HAL, GraphQLJSON through Laravel API resources, JSON:API resources as an option
API docsOpenAPI generated automatically, with Swagger UI and GraphiQLOpenAPI through Scramble, Postman collection export
Pagination and filtersBuilt in, filters declared by attributeGenerated in each service: filter[column], sort, per_page
Validation and authorizationLaravel form requests, gates and policiesStore and update form requests and a policy generated for each entity
TestsAssertion helpers for Pest and PHPUnit, tests written by youFeature and unit tests written for each entity, green right after generation
Changing behaviorConfiguration, state providers and processorsEdit the generated code, or the stubs for the next generations
Adding a columnMigrate, and the API reads the new column from the database--add-fields writes the migration and patches the model, requests, factory and resource
InputsEloquent models. Its schema generator can also write Doctrine entities, meant for Symfony, from an OpenAPI document or Schema.orgCLI flags, a YAML or JSON schema, a Mermaid diagram, an OpenAPI spec, an existing database, a description given to an AI agent
AI agentsAn experimental MCP server lets agents call your running API, and a Claude Code plugin with an AGENTS.md guides the agent that writes the codeAn MCP server through which coding agents plan and generate the API, every file shown before it is written
AlsoReal-time updates with Mercure, HTTP cache with invalidation, admin and client generatorsA VS Code extension

Which one to pick ​

API Platform shines when the API is the product: several formats or GraphQL from the same model, linked data, real-time updates, very little code in the repository, and a team ready to learn its concepts.

The generator suits teams that want to read every line of their API in the Laravel they already know, with a service layer, DTOs and tests from the first day and no framework to depend on in production. It also fits projects that start from an existing database, a schema file or a spec, and teams whose coding agents should produce the same structure every time.