Download the PHP package melsaka/api-builder without Composer
On this page you can find all versions of the php package melsaka/api-builder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download melsaka/api-builder
More information about melsaka/api-builder
Files in melsaka/api-builder
Package api-builder
Short Description Scaffold CRUD API (Controller, Service, Repository, Resource, Requests, Policies, etc.) for Laravel applications
License MIT
Homepage https://github.com/melsaka/api-builder
Informations about the package api-builder
Laravel API Builder
Scaffold CRUD API (Controller, Service, Repository, Resource, Requests, Policies, etc.) for Laravel applications.
Features
- Generate complete CRUD API structure
- Create Controllers, Services, Repositories
- Generate Resources and Form Requests
- Create Policies for authorization
- Includes API error handling traits
- Custom exceptions for API responses
- Supports uploading images to your models
This package is using my laravel image manager package to support adding images easily to your models.
Requirements
- PHP ^8.2
- Laravel ^11.0 or ^12.0
Installation
You can install the package via Composer:
The package will automatically register its service provider.
Usage
Publish Stubs
If you want to customize the generated files, publish the stub files:
Generate Required Files
First, generate the base API files (controllers, traits, exceptions):
Generate CRUD for a Model
Generate complete CRUD for a specific model:
This will create:
- Controller:
app/Http/Controllers/Api/User/UserController.php - Service:
app/Services/UserService.php - Repository:
app/Repositories/UserRepository.php - Resource:
app/Http/Resources/UserResource.php - Requests:
app/Http/Requests/User/StoreUserRequest.php&UpdateUserRequest.php - Policy:
app/Policies/UserPolicy.php - Routes:
app/Routes/User.php
Uploading Images To Your Models
Checkout laravel image manager package to learn what you need to do first.
Publish the configuration file:
Then you create the images table:
Add your model name and it's settings under the models attribute in the config file:
Add the Trait to your Model
Now all you need to do is to define the supported images function:
That's it now you can do:
For more info read about: laravel image manager docs
Configuration
The package works out of the box with sensible defaults. All generated files follow Laravel conventions and best practices.
Credits
License
The MIT License (MIT). Please see License File for more information.
All versions of api-builder with dependencies
illuminate/support Version ^11.0|^12.0
spatie/laravel-query-builder Version ^6.3
melsaka/laravel-image-manager Version ^1.0