Warning
This library is under active development and will continue to evolve until version 1.0. Features and API may change. Use in production at your own risk.
Any Object generates random instances of any class with zero configuration. Objects can be generated on-the-fly or with the codegen feature, which allows you to create and maintain Object Mothers and Object Builders automatically.
- Zero Configuration: Any Object attempts to create objects with minimal setup.
- Flexible Object Creation: Supports setting specific properties while randomizing the rest.
- Code Generation: Automatically builds and maintains Object Mothers and Builders for test purposes.
Install Any Object via Composer as a development dependency:
composer require --dev santakadev/any-object
You can quickly generate a random object of a given class:
$any = new AnyObject();
$object = $any->of(Product::class);
Fix certain properties while randomizing the rest:
$any = new AnyObject();
$object = $any->of(Product::class, with: ['name' => 'My Product']);
This library is open-sourced under the MIT license.