Download the PHP package jefferson-lima/fixture-factory without Composer

On this page you can find all versions of the php package jefferson-lima/fixture-factory. 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 fixture-factory

Fixture Factory

Generates fixture objects to be used in tests.

Installation

Usage

Fixture Factory uses the metadata of your class properties to generate values for them. The value generated for a property is derived from its @var tag. Thus, first you must annotate your properties with their types:

The properties without a @var tag, or with and invalid one, will be ignored.

Then you can use the FixtureFactory to create a fixture for your class:

Fixture Factory uses Faker to generate values.

Supported types

Currently, the supported types are string, int, bool, float. Objects are supported, as long as a concrete class is provided. Abstract classes or interfaces are not supported as it's not possible to determine the concrete implementation that should be used. Nested objects will be generated recursively.

Overriding attributes

It's possible to override attributes by passing an array as a second argument to the createFixture method:

Circular references

Care must be taken with circular references, they must be avoided or overridden, otherwise an exception will be thrown. One example of circular reference is shown below:

A circular reference can be broken by overriding one attribute:

Doctrine annotations can also be used to resolve circular references, for example:

In this case, it's possible to identify that foo points to bar, and that bar points back at it.

Symfony constraints

It's also possible to use Symfony validation constraints to narrow down the values generated for your properties. These are the currently supported constraints listed by order of precedence:

Strings:

Some constraints can't be applied simultaneously. In this case, the constraint with higher precedence is applied. For example:

In this case, the @Email constraint is applied, and the @Length will be ignored.

Doctrine Associations

The following Doctrine associations are supported:

For many side of the associations an ArrayCollection with two elements is created.

License

This project is licensed under the MIT License - see the LICENSE.md file for details


All versions of fixture-factory with dependencies

PHP Build Version
Package Version
Requires phpdocumentor/reflection-docblock Version ^5.1
fzaninotto/faker Version ^1.9
symfony/validator Version ^5.0
doctrine/annotations Version ^1.10
doctrine/orm Version ^2.7
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 jefferson-lima/fixture-factory contains the following files

Loading the files please wait ...