doctrine/instantiator

A small, lightweight utility to instantiate objects in PHP without invoking their constructors

Package info

github.com/doctrine/instantiator

Homepage

pkg:composer/doctrine/instantiator

Statistics

Installs: 878 009 068

Dependents: 370

Suggesters: 3

Stars: 11 003

Open Issues: 1

2.1.0 2026-01-05 06:47 UTC

Requires

  • php: ^8.4

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 23da848e1a2308728fe5fdddabf4be17ff9720c7

constructorinstantiate


README

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.