instantiator README

The project's README from github.com/doctrine/instantiator. As one markdown file: README.md.

Doctrine Instantiator

This library provides a way of avoiding usage of constructors when instantiating PHP classes.

Build Status Code Coverage Dependency Status

Latest Stable Version Latest Unstable Version

Installation

The suggested installation method is via composer:

composer require doctrine/instantiator

Usage

The instantiator is able to create new instances of any class without using the constructor or any API of the class itself:

$instantiator = new \Doctrine\Instantiator\Instantiator();

$instance = $instantiator->instantiate(\My\ClassName\Here::class);

Contributing

Please read the CONTRIBUTING.md contents if you wish to help out!

Credits

This library was migrated from ocramius/instantiator, which has been donated to the doctrine organization, and which is now deprecated in favour of this package.

instantiator (doctrine/instantiator)

Searching Database…

What is this?Doctrine Instantiator is a small PHP library that creates new instances of a class without calling its constructor or any other method on it.
Is it a library or a standalone tool?It is a tiny PHP library meant to be required as a Composer dependency inside other projects, not a standalone application.
How do I add it to a project?Install it with Composer, then call the instantiator's API to get a new instance of any class without invoking its constructor.
Do I need anything besides PHP and Composer?No extra dependencies are listed; it only needs PHP and Composer to install.
Who typically uses this library?It's mainly used by other libraries and frameworks (like Doctrine ORM and testing/mocking tools) that need to build objects while bypassing constructor logic.
Why would I want to skip a class's constructor?This is useful for things like deserialization, mocking, or ORM hydration where you need an object instance before its constructor arguments are known.
Is this project actively maintained?It is maintained under the Doctrine organization and has CI workflows for coding standards, static analysis, and benchmarks, suggesting active upkeep.
Was this always part of Doctrine?No, it was migrated from the ocramius/instantiator package, which was donated to Doctrine and is now deprecated in favor of this one.
How big is this library?It's a very small, single-purpose utility library with no runtime dependencies of its own.
What are similar projects?pest, mockery, lexer, voyager, composer, _s, woocommerce, symfony
Which topics is it in?composer, php, testing, library, developer-tools, mit
Creator
doctrine
Size
0.5 MB
Stars
11K
Age
12y
Commits · 90 Days