Download the PHP package innova-studio/laravel-crud-generator without Composer
On this page you can find all versions of the php package innova-studio/laravel-crud-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download innova-studio/laravel-crud-generator
More information about innova-studio/laravel-crud-generator
Files in innova-studio/laravel-crud-generator
Package laravel-crud-generator
Short Description Laravel CRUD Generator is a library to automate the creation of files for Laravel APIs
License MIT
Informations about the package laravel-crud-generator
Laravel CRUD Generator
[![Latest Version on Packagist](https://img.shields.io/packagist/v/innova-studio/laravel-crud-generator.svg?style=flat-square)](https://packagist.org/packages/innova-studio/laravel-crud-generator)
[![Total Downloads](https://img.shields.io/packagist/dt/innova-studio/laravel-crud-generator?style=flat-square)](https://packagist.org/packages/innova-studio/laravel-crud-generator)
Laravel CRUD Generator is a library to automate the creation of files for Laravel APIs
Installation
-
To install the package run
- Add "InnovaStudio\LaravelCrudGenerator\LaravelCrudGeneratorServiceProvider::class," as a package service provider in your config/app.php file
-
To generate package config files run
- Update json file called "laravel-crud-generator.json" with all the things that you need
-
Run "php artisan crud:generate" to generate all the files for the definitions given at laravel-crud-generator.json file
General configuration
To install the package run
To generate package config files run
Run "php artisan crud:generate" to generate all the files for the definitions given at laravel-crud-generator.json file
Inside config folder you will find a file called "laravelCrudGenerator.php". There you can modify the default behavor of the generator. Here you have a table with all the attributes you can modify:
Attribute | Description | Type | Example |
---|---|---|---|
default_file_path | Indicates the path to json file | string | |
rewrite | Indicates if files are allowed to be rewritten if the generator runs | boolean | |
files | Indicates what type of files the generator is allowed to generate. All types of file are listed in the example. | array | |
relations | Indicates the default relationships of the files generated. This is in case you need to stablish a relationship by default for all files. | array of relations | |
routes | Indicates the default configuration for routes files | array | |
model | Indicates the default configuration for model files | array | |
controller | Indicates the default configuration for controller files | array | |
request | Indicates the default configuration for request files | array | |
resource | Indicates the default configuration for resource files | array | |
service | Indicates the default configuration for service files | array | |
migration | Indicates the default configuration for migration files | array | |
factory | Indicates the default configuration for factory files | array | |
mock | Indicates the default configuration for mock seeder files | array | |
test | Indicates the default configuration for test files | array |
Configuration of laravel-crud-generator.json
As you may see, this file comes with an example. The hierarchy of the file is this:
Entity
Enetity general configuration attributes
File
File attributes configuration
General Attributes
Attribute | Description | Type | Example |
---|---|---|---|
nameSingular | Indicates the singular name of the entity | string (optional) | |
namePlural | Indicates the plural name of the entity | string (optional) | |
rewrite | Indicates if the files of the entity should be rewritten | boolean (optional) | |
files | Indicates what files of the entity should be created | array (optional) | |
attributes | Indicates the attributes of the entity | object of objects (optional) | |
relations | Indicates the relationships of the entity | object of objects (optional) | |
files | Indicates what files of the entity should be created | array (optional) | |
routes | Indicates the attributes for routes file of the entity | object (optional) | -- |
model | Indicates the attributes for model file of the entity | object (optional) | -- |
controller | Indicates the attributes for controller file of the entity | object (optional) | -- |
request | Indicates the attributes for request file of the entity | object (optional) | -- |
resource | Indicates the attributes for resource file of the entity | object (optional) | -- |
service | Indicates the attributes for service file of the entity | object (optional) | -- |
migration | Indicates the attributes for migration file of the entity | object (optional) | -- |
factory | Indicates the attributes for factory file of the entity | object (optional) | -- |
mock | Indicates the attributes for mock seeder file of the entity | object (optional) | -- |
test | Indicates the attributes for test file of the entity | object (optional) | -- |
Type of Files
Right now, there are 10 types of files that can be generated:
- Routes
- Model
- Controller
- Request
- Resource
- Service
- Migration
- Factory
- Mock Seeder
- Test
Routes
Attribute | Description | Type | Example |
---|---|---|---|
filePath | Indicates the path of the file | string (optional) | |
use | Indicates the traits that should be included in this file | array of strings (optional) | |
rewrite | Indicates if the file should be rewritted if exist | boolean (optional) |
Model
Attribute | Description | Type | Example |
---|---|---|---|
filePath | Indicates the path of the file | string (optional) | |
namespace | Indicates the namespace of the class | string (optional) | |
classname | Indicates the name of the class | string (optional) | |
table | Indicates the table of the model | string (optional) | |
primaryKey | Indicates the primary key of the model | string (optional) | |
traits | Indicates the traits that should be implemented in this class | array of strings (optional) | |
use | Indicates the traits that should be included in this class | array of strings (optional) | |
interfaces | Indicates the interfaces that should implement this class | array of strings (optional) | |
extends | Indicates the path of the extended class | string (optional) | |
rewrite | Indicates if the file should be rewritted if exist | boolean (optional) |
Controller
Attribute | Description | Type | Example |
---|---|---|---|
filePath | Indicates the path of the file | string (optional) | |
namespace | Indicates the namespace of the class | string (optional) | |
classname | Indicates the name of the class | string (optional) | |
traits | Indicates the traits that should be implemented in this class | array of strings (optional) | |
use | Indicates the traits that should be included in this class | array of strings (optional) | |
interfaces | Indicates the interfaces that should implement this class | array of strings (optional) | |
extends | Indicates the path of the extended class | string (optional) | |
rewrite | Indicates if the file should be rewritted if exist | boolean (optional) | |
methods | Indicates the methods that should be implemented in this controller. You can add cannonical methods (list, store, show, update, delete, restore) or your own custom methods. | array of strings (optional) |
Usage
To generate files is neccesary to config the laravel-crud-generator.json file and then run "php artisan crud:generate" command.