🏄 Utility for creating objects in PHP from constructor parameters definitions.
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
src
tests
.gitattributes
.gitignore
.php_cs
.scrutinizer.yml
.travis.yml
CHANGELOG.md
CONTRIBUTING.md
LICENSE
README.md
composer.json
phpunit.xml.dist

README.md

Cascader

Build Status Code Quality Code Coverage Latest Version PDS Skeleton

Cascader enables the creation of objects from array definitions that represent constructor parameters. Given the class name and creation options array, it will try to create a target object, also creating nested objects that may exist. Convenient as a factory for generic kind of objects.

Installation

The preferred method of installation is via Composer. Run the following command to install the latest version of a package and add it to your project's composer.json:

composer require nikolaposa/cascader

Usage

$cascader = new Cascader();

$object = $cascader->create(RootObject::class, [
    'name' => 'foo',
    'sub_object' => [
        'category' => 'bar',
        'count' => 10,
    ],
    'is_active' => true,
]);

See more examples.

Credits

License

Released under MIT License - see the License File for details.