Skip to content

CLI Reference

Commands

bash
php artisan make:fullapi {name?} {--fields=} {--soft-deletes} {--postman} {--auth} {--interactive} {--only=}
                         {--schema=} {--mermaid=} {--from-database} {--tables=} {--with-migrations} {--query-builder}
                         {--pest} {--json-api} {--add-fields=}
php artisan delete:fullapi {name?} {--force}
php artisan api-generator:clean-routes {--dry-run}
php artisan api-generator:introspect {--table=}
php artisan api-generator:validate-stubs {--json}
php artisan api-generator:install

make:fullapi

Argument / OptionDescription
nameEntity name (PascalCase). Omit to use the schema file / JSON mode.
--fieldsField definitions in name:type format, comma-separated. enum(a,b) and :primary supported.
--soft-deletesAdd SoftDeletes trait, migration column, restore/forceDelete endpoints.
--postmanExport a Postman v2.1 collection after generation.
--authScaffold Sanctum authentication (AuthController, requests, routes, middleware).
--interactiveLaunch the step-by-step wizard for guided entity creation.
--only=Type,TypeRegenerate only the listed artifacts; skip route + seeder registration.
--schema=fileGenerate every entity from a declarative YAML/JSON schema file.
--mermaid=fileGenerate every entity from a Mermaid erDiagram / classDiagram.
--from-databaseIntrospect the existing database and generate APIs for its tables.
--tables=a,bRestrict --from-database to specific tables.
--with-migrationsWith --from-database: also generate the migration files.
--query-builderUse spatie/laravel-query-builder for index filtering and sorting.
--pestGenerate Pest tests instead of PHPUnit.
--json-apiGenerate JSON:API-compliant resources (JsonApiResource, Laravel 12.45+). Falls back to a standard resource on older versions.
--add-fields=a:type,b:typeAdd fields to an existing entity: incremental migration + in-place patches.

--only types: Model, Controller, Service, DTO, Request, Resource, Migration, Factory, Seeder, Policy, FeatureTest, UnitTest.

delete:fullapi

Argument / OptionDescription
nameEntity to delete. Omit to delete every entity defined in class_data.json.
--forceSkip the confirmation prompt.

Removes all generated files, unregisters the seeder, and strips the entity's routes from routes/api.php and routes/web.php.

api-generator:clean-routes

Removes routes pointing to controllers that no longer exist (fixes the route:list ReflectionException after manual deletions).

OptionDescription
--dry-runList the orphan lines without touching the files.

api-generator:introspect

Emits the project's database schema as JSON for tooling.

OptionDescription
(none)List all user tables (system tables filtered out).
--table=nameDescribe one table: column names, normalized types, soft-deletes flag.

api-generator:validate-stubs

Verifies that published stubs still contain every required .

OptionDescription
--jsonMachine-readable output; exit code 1 on error (CI-friendly).

api-generator:install

Installs and configures the package and its optional dependencies interactively.