Download the PHP package ronasit/laravel-entity-generator without Composer

On this page you can find all versions of the php package ronasit/laravel-entity-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-entity-generator

Laravel-Entity-Generator

Coverage Status

Laravel-Entity-Generator - This generator is used to create a standard class stack for a new entity.

Installation

Install package using dev mode

Publish package's resources.

Usage

Entity generation

Call make:entity artisan command to run the generation command for the full stack of the entity classes:

Entity name may contain the subfolder, in this case generated model and nova resource will be placed to the subfolder as well:

Fields definition options

The make:entity provides an ability to set the entity's fields, which will be used in all created classes (e.g. Model, Create/Update requests, Test fixtures, etc.)

The following field types are available to use:

Type Short Option Full Option
integer -i --integer
float -f --float
string -s --string
boolean -b --boolean
datetime -t --timestamp
json -j --json

Fields modifiers

To set a special behavior for the field use the modifiers syntax. Modifiers may be passed using a : symbol in the field definition. Multiple modifiers can be combined with a comma.

Each modifier has full and short syntax. The list of available modifiers defined in the table:

Modifier Short syntax Description
required r Disallow to set null as a field value. Add required validation rule for creation, filled validation for the update, and not null in migration
unique u Add a unique index in migration and unique validation rule for creation and update

Reserved field names

The following field names are reserved and cannot be passed as input fields because they are managed automatically by Laravel and the generator:

Field Reason
id Primary key, added by Laravel automatically
created_at Timestamp, managed by Eloquent
updated_at Timestamp, managed by Eloquent

Relations definitions options

Command also provides an ability to set relations, which will be added to the model

Relation may be placed in the subfolder, in this case - set the relative namespace from the model directory:

The following options are available to set relations:

Type Short Option Full Option
Has one -a --has-one
Has many -A --has-many
Belongs to -e --belongs-to
Belongs to many -E --belongs-to-many

Single class generation mode options

Command allows to generate only single entity-related class

The following options are available:

Mode combination options

Sometimes you need to generate the stack of classes to work with some entity only inside the application without the ability to manipulate it using API, or you need to create only API for already existed entity.

For this task, there are two mutually exclusive options:

  1. --only-entity, generate stack of classes to work with entity only inside the app, it includes:

    • migration
    • model
    • service
    • repository
    • factory
    • seeder
  2. --only-api, generate stack of classes to implement API part to work with already existed entity:
    • routes
    • controller
    • requests
    • resources
    • factory
    • tests

Methods setting options

By default, the command generate all methods from the CRUD stack which includes:

But what if we need to create the interface only for updating and reading the entity? Just use the methods option for it:

Feel free to use any combinations of actions in any order. Each action has its own character:

The option affects not only the generated methods, but the set of generated classes as well:

Character What is generated
C create route, method and test, Create{Entity}Request, {Entity}Resource
R get and search routes, methods and tests, Get{Entity}Request and Search{Entities}Request, {Entity}Resource and {Entities}CollectionResource, search method in the service
U update route, method and test, Update{Entity}Request
D delete route, method and test, Delete{Entity}Request

So the classes listed for --only-api above are generated only when the corresponding characters are present. For example, --methods=UD generates neither {Entity}Resource nor {Entities}CollectionResource, and the service is generated without the search method.

Special class-related options

Release notes

1.3

Since 1.3 version you need to add to your config/entity-generator.php following data:


All versions of laravel-entity-generator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
laravel/framework Version >=11
ronasit/laravel-helpers Version >=3.5
ext-json Version *
doctrine/dbal Version ^4.2
winter/laravel-config-writer Version >=1.2.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ronasit/laravel-entity-generator contains the following files

Loading the files please wait ...