Download the PHP package thedoctor0/laravel-factory-generator without Composer

On this page you can find all versions of the php package thedoctor0/laravel-factory-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-factory-generator

Laravel Factory Generator

Packagist Packagist License

[Banner]()

Automatically generate factories from your existing models.

It will allow you to write tests containing your models much faster.

Installation

You can install the package via composer:

For Laravel 8.x and 9.x check the v1.3.2.

For Laravel 6.x and 7.x check the v1.2.5.

Usage

To generate all factories at once, simply run this artisan command:

It will find all models and generate test factories based on the database structure and model relations.

Example

Migration and Model

Generated Factory

Advanced usage

Selecting models

To generate a factory for only specific model or models, run the artisan command:

Overwriting existing factories

By default, generation will not overwrite any existing model factories.

You can force overwriting existing model factories by using the --force option:

Customizing the output directory

By default, it will search recursively for models under the app/Models directory.

If your models are within a different folder, you can specify this using --dir option.

In this case, run the artisan command:

Customizing the namespace

If your models are within a different namespace, you can specify it using --namespace option.

You just need to execute this artisan command:

Using recursive mode

By default, your model directory structure is not taken into account, even though it has subdirectories.

You can reflect it to database/factories directory by using the --recursive option:

Customizing the factory template

If you want you can customize the factory template to suit your needs.

To publish a factory template to resources/views/vendor/factory-generator/factory.blade.php, run the artisan command:

License

The MIT License (MIT). Please see license file for more information.


All versions of laravel-factory-generator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0
illuminate/console Version ^10.0|^11.0
illuminate/filesystem Version ^10.0|^11.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 thedoctor0/laravel-factory-generator contains the following files

Loading the files please wait ....