Laravel API Generator: Generate a REST API from a Laravel model

Recommend this page to a friend!
  Info   Documentation   View files (23)   Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2020-07-15 (22 days ago) Not yet rated by the usersTotal: 26 This week: 3All time: 9,966 This week: 69
Version License PHP version Categories
laravel-api-generato 1.0.0Custom (specified...5PHP 5, Libraries, Web services, Code ...
Description Author

This package can be used to generate a REST API from a Laravel model.

It takes the name of given model and generates files to implement a Web services API for handling calls to the model class.

Currently the package can generate controller, resource, collection and route classes.

Picture of Bhavin Gajjar
Name: Bhavin Gajjar <contact>
Classes: 1 package by
Country: United States United States
Age: ???
All time rank: 4356504 in United States United States
Week rank: 79 7 in United States United States


Laravel API Generator With Resources

Latest Version on Packagist Build Status Quality Score Total Downloads StyleCI

This package is used to generate laravel api with Resources


You can install the package via composer:

composer require bhavingajjar/laravel-api-generator

Publish Configuration File

php artisan vendor:publish --provider="Bhavingajjar\LaravelApiGenerator\LaravelApiGeneratorServiceProvider" --tag="config"

Next, if you plan for cross origin support, you should add middleware to your api middleware group within your app/Http/Kernel.php file:

add in env
for allow cross origin support
for json content type


php artisan api:generate --model=User


composer test


Please see CHANGELOG for more information what has changed recently.


Please see CONTRIBUTING for details.


If you discover any security related issues, please email instead of using the issue tracker.



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

File Role Description
.github (1 directory)
config (1 file)
src (3 files, 3 directories)
tests (1 file)
.editorconfig Data Auxiliary data
.scrutinizer.yml Data Auxiliary data
.styleci.yml Data Auxiliary data
.travis.yml Data Auxiliary data Data Auxiliary data
composer.json Data Auxiliary data Data Auxiliary data
index.html Doc. Documentation Lic. License text
phpunit.xml.dist Data Auxiliary data Doc. Documentation
_config.yml Data Auxiliary data

  Files  /  .github  
File Role Description
workflows (1 file)

  Files  /  .github  /  workflows  
File Role Description
   laravel.yml Data Auxiliary data

  Files  /  config  
File Role Description
   config.php Aux. Auxiliary script

  Files  /  src  
File Role Description
Commands (1 file)
Middleware (1 file)
resources (1 directory)
   LaravelApiGenerator.php Class Class source
   LaravelApiGeneratorFacade.php Class Class source
   LaravelApiGeneratorServiceProvider.php Class Class source

  Files  /  src  /  Commands  
File Role Description
   GenerateApi.php Class Class source

  Files  /  src  /  Middleware  
File Role Description
   ApiHeaderInject.php Class Class source

  Files  /  src  /  resources  
File Role Description
stubs (3 files)

  Files  /  src  /  resources  /  stubs  
File Role Description
   collection.stub Class Class source
   controller.stub Class Class source
   resource.stub Class Class source

  Files  /  tests  
File Role Description
   ExampleTest.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:3
All time:9,966
This week:69

For more information send a message to info at phpclasses dot org.