You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.6 KiB

3 years ago
  1. # Instantiator
  2. This library provides a way of avoiding usage of constructors when instantiating PHP classes.
  3. [![Build Status](https://travis-ci.org/doctrine/instantiator.svg?branch=master)](https://travis-ci.org/doctrine/instantiator)
  4. [![Code Coverage](https://codecov.io/gh/doctrine/instantiator/branch/master/graph/badge.svg)](https://codecov.io/gh/doctrine/instantiator/branch/master)
  5. [![Dependency Status](https://www.versioneye.com/package/php--doctrine--instantiator/badge.svg)](https://www.versioneye.com/package/php--doctrine--instantiator)
  6. [![Latest Stable Version](https://poser.pugx.org/doctrine/instantiator/v/stable.png)](https://packagist.org/packages/doctrine/instantiator)
  7. [![Latest Unstable Version](https://poser.pugx.org/doctrine/instantiator/v/unstable.png)](https://packagist.org/packages/doctrine/instantiator)
  8. ## Installation
  9. The suggested installation method is via [composer](https://getcomposer.org/):
  10. ```sh
  11. php composer.phar require "doctrine/instantiator:~1.0.3"
  12. ```
  13. ## Usage
  14. The instantiator is able to create new instances of any class without using the constructor or any API of the class
  15. itself:
  16. ```php
  17. $instantiator = new \Doctrine\Instantiator\Instantiator();
  18. $instance = $instantiator->instantiate(\My\ClassName\Here::class);
  19. ```
  20. ## Contributing
  21. Please read the [CONTRIBUTING.md](CONTRIBUTING.md) contents if you wish to help out!
  22. ## Credits
  23. This library was migrated from [ocramius/instantiator](https://github.com/Ocramius/Instantiator), which
  24. has been donated to the doctrine organization, and which is now deprecated in favour of this package.