Download the PHP package nameless/laravel-api-generator without Composer
On this page you can find all versions of the php package nameless/laravel-api-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nameless/laravel-api-generator
More information about nameless/laravel-api-generator
Files in nameless/laravel-api-generator
Package laravel-api-generator
Short Description A powerful Laravel API generator that automatically creates a complete API structure including models, controllers, services, DTOs, policies, resources, factories, migrations, Seeders and more with a single command.
License MIT
Informations about the package laravel-api-generator
Laravel API Generator
Laravel API Generator is a powerful Laravel package that generates a complete API structure, including Models, Controllers, Services, DTOs, Policies, Resources, Factories, Seeders, and Migrations, with a single command.
Features
- Generate a complete API structure with one command.
- Create Models with proper relationships.
- Generate RESTful Controllers.
- Implement the Service Layer pattern.
- Create Data Transfer Objects (DTOs).
- Generate Resources for API responses.
- Automatically set up Policies.
- Generate Factories and Seeders.
- Create Migrations.
- Support for configurable field types and validations (FormRequest).
- Delete generated API structures with a single command.
Installation
You can install the package via Composer:
Then, run the installation command to set up the package:
The package will automatically register its service provider.
Usage
Generate Authentication
If you want to get started with authentication using Laravel's starter kits, run:
Generate a Complete API Structure
You can generate a complete API structure in two ways:
-
Using a UML Diagram: Ensure you have a
class_data
file in the root directory containing your classes and their attributes. Then run:form of class_data file
-
Without a UML Diagram:
Use the following command to generate the API structure:
Example
This command will generate:
- Models (
App\Models
) - Controllers (
App\Http\Controllers
) - Services (
App\Services
) - DTOs (
App\DTO
) - Policies (
App\Policies
) - Requests (
App\Http\Requests
) - Resources (
App\Http\Resources
) - Factories (
Database\Factories
) - Migrations (
Database\Migrations
) - Seeders (
Database\Seeders
)
Delete API Structure
To remove the generated API structure, you can use:
This will remove all the generated files from the API structure.
To delete a specific model's API structure, use:
For example:
This will delete all the generated files related to the Post model, including controllers, services, DTOs, policies, resources, factories, seeders, and migrations.
Architecture
Supported Field Types
Type | Description | Default Validation |
---|---|---|
string | String of characters | max:255 |
integer | Whole number | numeric |
boolean | Boolean value | boolean |
text | Long text | string |
date | Date | date |
datetime | Date and time | datetime |
timestamp | Unix timestamp | timestamp |
Generated Structure
Controller
Service
DTO
Model
Resource
Request
Factory
Seeder
Policy
Migration
Testing
To run the tests, use the following command:
Local Development
-
Clone this repository:
-
Install dependencies:
- Run tests:
Testing in a Laravel Project
-
In your Laravel project's
composer.json
, add: - Run:
Security
If you discover any security-related issues, please email [email protected] instead of using the issue tracker.
Credits
License
This package is open-source and distributed under the MIT License. See the LICENSE file for more details.