Download the PHP package filippo-toso/models-generator without Composer

On this page you can find all versions of the php package filippo-toso/models-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 models-generator

Models Generator

A Laravel Artisan command to automatically generate models from database tables.

Requirements

Installing

Use Composer to install it:

How does it work?

This generator is very simple. It builds the models from the database and saves them in the App\Models namespace. Then extends these models with the user's counterpart in the App namespace. If you follow Laravel's guidelines for tables and columns naming, it works like a charm ;)

After you have executed the first generation, you can go and customize the models in the App namespace as usual. If you change the database (as often happens during development), you can run the generator again (with the override option enabled) and get an updated set of models without any additional effort.

This solution leaves you the benefit of automatic code generation plus the ability to add/change the behavior of your models (ie. change attributes visibility, add relationships, and so on).

By default the generator doesn't create the models of Laravel's tables like jobs, cache, and so on. You can modify this behavior publishing the package resources and editing the config/models-generator.php file.

Configuration

You can publish the configuration file with the following command:

The config/model-generator.php file allows you to:

Just open the file and read the comments :)

Keep in mind that the one to many and many to many relationships are built using the foreign keys you define in the database.

Options

The predefined use from command line is:

This command executes the following steps:

If there are existing models in the App\Models namespace they will not be overwritten by default (see the next example). If there are existing models in the App namespace they will never be overwritten.

You can modify the default behavior using the following parameters:

With the overwrite option set the generator will always overwrite the models in the App\Models namespace. This can be done safely if you follow the rule to not change these models but edit the ones in the App namespace.

You can specify a different connection if you need to.

Workflow

To gain the maximum benefits from this package you should follow this workflow:

Then, every time you create and run a new migration, you should execute the generator again to keep the models in sync with the database.

You must also follow Laravel's guidelines about tables and columns names otherwise the generator will not be able to identify the existing relationships.


All versions of models-generator with dependencies

PHP Build Version
Package Version
Requires php Version ^7.0 || ^8.0 || ^9.0
illuminate/support Version >=8.0
laravel/helpers Version ^1.3
doctrine/dbal Version ^2.8 || ^3.0
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 filippo-toso/models-generator contains the following files

Loading the files please wait ....