fariddomat/auto-api
Laravel package that generates complete REST API modules via an interactive Artisan command: models, migrations, controllers, routes, and OpenAPI docs. Supports file uploads, pagination, soft deletes, searchable fields, and select-field relationships.
Auto-API is a Laravel package that automates the generation of RESTful API endpoints for your models with a single interactive command. It creates models, migrations, controllers, routes, and OpenAPI specifications, supporting features like file uploads, pagination, soft deletes, searchable fields, and relationship data for select fields—all with a colorful CLI experience.
Install Auto-API via Composer:
composer require fariddomat/auto-api:dev-main
No additional setup is required—the package auto-registers its command via the service provider.
Use the interactive make:auto-api Artisan command to generate an API module:
php artisan make:auto-api
Welcome to AutoAPI Generator! Let's create your API step-by-step.
Model name? (e.g., Post; must start with a capital letter): Product
Define fields for Product (e.g., title:string, user_id:select). Leave blank to finish.
Enter a field: name:string
Enter a field: category_id:select
Enter a field: image:image
Enter a field: <Enter>
API version? (e.g., v1, v2; default: v1): v1
Enable soft deletes? (Default: No) [N/y]: y
Enable search functionality? (Default: No) [N/y]: y
Searchable fields (comma-separated, from: name, category_id, image): name
Middleware (comma-separated, e.g., auth:api,throttle; leave blank for none): auth:api
API Settings:
Model: Product
Fields: name:string, category_id:select, image:image
Version: v1
Soft Deletes: Yes
Search Enabled: Yes
Searchable Fields: name
Middleware: auth:api
Proceed with these settings? [Y/n]: <Enter>
Generating Auto API for Product...
How can I help you explore Laravel packages today?