worksofallen/laravel-api-scaffold

A simple way to send batch emails
1,934
Install
composer require worksofallen/laravel-api-scaffold
Latest Version:v1.4.0
PHP:^8.2
Laravel:10 – 13
Older releases:8 · 9
License:MIT
Last Updated:Oct 6, 2026
Links: GitHub  ·  Packagist
Maintainer: alvarezallen99

Laravel API Scaffold Command

Status License PHP Latest Version on Packagist Downloads


A Laravel Artisan command to quickly scaffold a complete RESTful API resource, including:

  • Eloquent Model with SoftDeletes & fillable setup
  • Migration file with a name column and soft deletes support
  • API Controller with basic CRUD operations & pagination, filtering, sorting
  • Form Request classes for validation with proper JSON error responses

Installation

Require the package via Composer:

composer require worksofallen/laravel-api-scaffold:v1.0.0 --dev

Publish the command if necessary (depends on how you package it).


Usage

Run the custom Artisan command to generate a full API scaffold for a resource:

php artisan make:api {name}

Replace {name} with the singular model name, e.g., Product, Category, etc.

What gets created?

  • app/Models/{Name}.php — Model with fillable name attribute and soft deletes.
  • database/migrations/xxxx_xx_xx_xxxxxx_create_{snake_plural}_table.php — Migration with name and soft deletes columns.
  • app/Http/Requests/{Name}StoreRequest.php — Validation request for storing.
  • app/Http/Requests/{Name}UpdateRequest.php — Validation request for updating.
  • app/Http/Controllers/API/{Name}Controller.php — API controller with:
  • index method supporting search (q), sort (sortField, sortOrder), and pagination (sizePerPage).
  • store, show, update, destroy methods.

Features

  • Standardized API scaffolding reduces repetitive boilerplate code.
  • Soft deletes enabled by default.
  • Search, sort, paginate support out of the box.
  • JSON validation error responses for API-friendly error handling.
  • Clean, maintainable, and easy to customize generated code.

Example

php artisan make:api Product

Generates Product API scaffolding:

  • Model: app/Models/Product.php
  • Migration: database/migrations/xxxx_xx_xx_create_products_table.php
  • Requests: ProductStoreRequest, ProductUpdateRequest
  • Controller: app/Http/Controllers/API/ProductController.php

Authors

Changelog

Please see CHANGELOG for more information what has changed recently.

Security

Please review our security policy on how to report security vulnerabilities.

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

Related Packages

mckenziearts/laravel-command

A simple Laravel package to provide artisan new commands

1,198 32
fedeisas/laravel-js-routes

Laravel 4 routes from Javascript

140,793 62
czim/laravel-repository

Repository for Laravel (inspired by and indebted to Bosnadev/Repositories)

116,119 52
barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve...

146,424,078 14,969

Version History

Version Released PHP Laravel License
v1.4.0 ^8.2 ^10.0 || ^11.0 || ^12.0 || ^13.0 MIT
v1.3 ^8.1 ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0 MIT
v1.2 ^8.1 ^8.0 || ^9.0 || ^10.0 || ^11.0 MIT
v1.0.2 ^8.1 ^8.0 || ^9.0 || ^10.0 || ^11.0 MIT
v1.0.1 ^8.1 ^8.0 || ^9.0 || ^10.0 || ^11.0 MIT