Download the PHP package mf1dd/object-builder without Composer

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

ObjectBuilder

Automatic object creation with random values for PHP 8.2+.

Why?

Manually creating test objects is repetitive, error-prone, and time-consuming — especially for deeply nested object graphs with dozens of properties. Every constructor change forces you to update all test fixtures.

ObjectBuilder solves this: class name in, fully populated instance out. Recursive, type-safe, with semantically meaningful values.

Advantages

Compatibility

PHP Version Status
8.2 Fully supported, CI-tested
8.3 Fully supported, CI-tested
8.4 Fully supported, CI-tested
8.5 CI-tested (once available)

Basic Usage

Simple classes are automatically populated with random values.

You can override specific values. Unset values are generated randomly. Nested objects are resolved automatically.

Enumerations

You can specify which values the enum should use.

Traits

For traits, an anonymous class is created that uses the trait. Parameters passed to the TraitBuilder are ignored.

Interfaces

The given interface is loaded and a class is dynamically generated from it. It returns the interface with the required methods and implements the interface.

The return value of methods is determined and a random value is assigned.

You can specify which values the methods should return. Pass an array with the method name as the key.

If a method returns an object and you want to set values in it, that works too.

It is also possible to pass individual parameters to the object.

Readonly Classes

Readonly classes (PHP 8.2+) are supported. Properties are automatically populated in the constructor — including nested ones.

Abstract Classes

Abstract classes are resolved via existing concrete subclasses. The builder automatically finds a suitable implementation.

Stock Classes (PHP Built-Ins)

Built-in PHP classes like DateInterval, DatePeriod, DateTime, DateTimeImmutable, ReflectionFunction, ArrayObject, and SplFileInfo are automatically supported.

Custom handlers for additional stock classes can be registered:

Value Constraints (with())

The with() method allows setting constraints for value ranges.

Available constraints:

Semantic String Detection

The StringBuilder recognizes specific property names and generates matching values:

Custom Type Builders

Custom type builders can be registered for specific data types:

Custom Builder Override

The automatically selected builder can be overridden:


All versions of object-builder with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
nikic/php-parser Version ^5.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 mf1dd/object-builder contains the following files

Loading the files please wait ...