Download the PHP package kfirba/factor without Composer

On this page you can find all versions of the php package kfirba/factor. 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 factor

Factor

Short and expressive way to use Laravel's model factories.

Install

Usage

I've written a more detailed blog about this package. Make sure to check it out!

The package registers 2 global methods:

  1. make($model, $overrides = [], $times = 1)
  2. create($model, $overrides = [], $times = 1)

These methods are almost identical to the create() and make() method that the Illuminate\Database\Eloquent\Factory offers (usually you use the factory() global method to obtain an instance of the factory).

The examples below are the same for both the create() and make() methods. The only difference is that the create() method will also persist the generated instances.

It looks like that create() and make() methods are just simple aliases to the factory()->{$method}(), but this is where it gets interesting.

I Want to Decide!

It may sometimes feel "right" to pass the number of objects we want to build as the second argument instead of the overrides. Factor lets you do that. If you pass an integer as the second argument, it will assume you are trying to set the number of objects to create:

States

So we decided we want to use a shorthand to the factory()->create() call, however, what happens when we want to give it a certain state? The simplest solution is to tweak the make() and create() methods a little bit and make it accepts an additional argument.

However, the argument list gets pretty long and given that both the $overrides and the $times arguments are optionals, it makes it a mess to do it that way.

This package lets you use an expressive syntax to declare your states:

Pay close attention to the above admin state. We call the states() method directly on the make() returned value and we are still able to access any property or method off of the actual instance. This is exactly the added bonus this package offers.

small Caveat (Immediate Creation of Models)

Sometimes we want to create models just as a part of the test's setup but we never really need to directly interact with them. Factor will not immediately create the models but will decide in real-time when they need to be created. This behavior will break your tests if you rely on the models to exist in the database only. To overcome this shortcoming, Factor also provides a now() method which will let you use it's elegant and expressive syntax but tell to immediately create the models:

License

Factor is open-sourced software licensed under the MIT license.


All versions of factor with dependencies

PHP Build Version
Package Version
Requires laravel/framework Version ^5.6
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 kfirba/factor contains the following files

Loading the files please wait ....