The make:fullapi Command
make:fullapi is the heart of the package. It accepts an entity name with inline fields, or reads from a schema file, a Mermaid diagram or your existing database.
Basic usage
php artisan make:fullapi Post --fields="title:string,content:text,published:boolean"Soft deletes
php artisan make:fullapi Post --fields="title:string,content:text" --soft-deletesAdds the SoftDeletes trait, a softDeletes() migration column, restore() / forceDelete() methods, and two extra routes:
POST /api/posts/{id}/restore
DELETE /api/posts/{id}/force-deleteSanctum authentication
php artisan make:fullapi Post --fields="title:string" --authScaffolds a complete token-based auth system: AuthController (register, login, logout, user), LoginRequest, RegisterRequest, public auth routes, and wraps your API resource routes inside auth:sanctum middleware.
| Method | Route | Access |
|---|---|---|
POST | /api/register | Public |
POST | /api/login | Public |
POST | /api/logout | auth:sanctum |
GET | /api/user | auth:sanctum |
GET | /api/posts | auth:sanctum (your resources require a token too) |
Then install Sanctum if not already present:
composer require laravel/sanctum
php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
php artisan migratePostman collection
php artisan make:fullapi Post --fields="title:string" --postmanExports a postman_collection.json (v2.1 schema) at the project root: a folder per entity with List, Create, Show, Update and Delete requests pre-filled with sample data. See API Docs & Postman.
Spatie QueryBuilder
composer require spatie/laravel-query-builder
php artisan make:fullapi Post --fields="title:string,content:text" --query-builderIndex endpoints become filterable and sortable through the community-standard spatie/laravel-query-builder:
GET /api/posts?filter[title]=laravel&sort=-created_atThe flag works with every generation mode, and query_builder: true can be set globally or per entity in a schema file.
Without the flag, generated index endpoints still support simple filtering on any fillable field (GET /api/posts?published=true); other parameters are silently ignored.
Pest tests
php artisan make:fullapi Post --fields="title:string" --pestGenerates it(...) / expect(...) style tests instead of PHPUnit classes, with the same coverage. See Generated Tests.
Interactive wizard
php artisan make:fullapi --interactiveA step-by-step guided setup: entity name, fields one by one (type, nullable, unique, default), relationships, options, and a full preview before generation. Ideal for configuring constraints not available in the --fields string syntax.
Regenerate selected files with --only=
To rebuild a Resource or a Test without touching everything else:
php artisan make:fullapi Post --fields="title:string,content:text" --only=FeatureTest,UnitTestWhen --only= is set, the migration, the apiResource route and the DatabaseSeeder registration are left untouched: only the listed artifacts are rewritten.
Available types: Model, Controller, Service, DTO, Request, Resource, Migration, Factory, Seeder, Policy, FeatureTest, UnitTest.
Deleting an entity
php artisan delete:fullapi PostRemoves all generated files, unregisters the seeder from DatabaseSeeder.php, and cleans the entity's routes from routes/api.php and routes/web.php. Called without an entity name, it deletes every entity defined in class_data.json.
If older deletions left routes pointing at controllers that no longer exist (the classic route:list ReflectionException), purge them:
php artisan api-generator:clean-routes --dry-runphp artisan api-generator:clean-routesAll options combined
php artisan make:fullapi Post --fields="title:string,content:text" --soft-deletes --postman --auth --pestThe full flag list lives in the CLI Reference.
