Laravel REST API Develop(Generate)

Dipesh Sukhia
1 min readJul 19, 2022

I recently launched a new package that gives you a powerful setup for REST API in comfortable Laravel syntax using Laravel`s own standard.

What Cover in this package?

below is the functionality covered in this package

  1. API route
  2. API resource ( Controller )
  3. Form Request
  4. API Resource
  5. API Collection
  6. API Response using Macro
  7. API Exception Handler

Github

Installation

you can install the package via composer:

composer require dipeshsukhia/laravel-api-develop

Usage

install default configuration

php artisan develop-api:install

use trait in App\Exceptions\Handler.php

use App\Exceptions\Traits\ApiHandlerTrait;

class Handler extends ExceptionHandler
{
use ApiHandlerTrait;
php artisan develop-api --model=User

How to use it?

You have to create the laravel database model and its migration and need to run php artisan develop-api — model=ModelName for generating or developing apis.

it will generate an API route, form request, API controller, API resource, and API collection based on Laravel standards.

--

--