index.rst 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. Introduction
  2. ============
  3. This library provides a way of avoiding usage of constructors when instantiating PHP classes.
  4. Installation
  5. ============
  6. The suggested installation method is via `composer`_:
  7. .. code-block:: console
  8. $ composer require doctrine/instantiator
  9. Usage
  10. =====
  11. The instantiator is able to create new instances of any class without
  12. using the constructor or any API of the class itself:
  13. .. code-block:: php
  14. <?php
  15. use Doctrine\Instantiator\Instantiator;
  16. use App\Entities\User;
  17. $instantiator = new Instantiator();
  18. $user = $instantiator->instantiate(User::class);
  19. Contributing
  20. ============
  21. - Follow the `Doctrine Coding Standard`_
  22. - The project will follow strict `object calisthenics`_
  23. - Any contribution must provide tests for additional introduced
  24. conditions
  25. - Any un-confirmed issue needs a failing test case before being
  26. accepted
  27. - Pull requests must be sent from a new hotfix/feature branch, not from
  28. ``master``.
  29. Testing
  30. =======
  31. The PHPUnit version to be used is the one installed as a dev- dependency
  32. via composer:
  33. .. code-block:: console
  34. $ ./vendor/bin/phpunit
  35. Accepted coverage for new contributions is 80%. Any contribution not
  36. satisfying this requirement won’t be merged.
  37. Credits
  38. =======
  39. This library was migrated from `ocramius/instantiator`_, which has been
  40. donated to the doctrine organization, and which is now deprecated in
  41. favour of this package.
  42. .. _composer: https://getcomposer.org/
  43. .. _CONTRIBUTING.md: CONTRIBUTING.md
  44. .. _ocramius/instantiator: https://github.com/Ocramius/Instantiator
  45. .. _Doctrine Coding Standard: https://github.com/doctrine/coding-standard
  46. .. _object calisthenics: http://www.slideshare.net/guilhermeblanco/object-calisthenics-applied-to-php