container.php 575 B

123456789101112131415161718192021
  1. <?php
  2. /**
  3. * Initialize a dependency injection container that implemented PSR-11 and return the container.
  4. */
  5. declare(strict_types=1);
  6. /**
  7. * This file is part of Hyperf.
  8. *
  9. * @link https://www.hyperf.io
  10. * @document https://hyperf.wiki
  11. * @contact group@hyperf.io
  12. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  13. */
  14. use Hyperf\Context\ApplicationContext;
  15. use Hyperf\Di\Container;
  16. use Hyperf\Di\Definition\DefinitionSourceFactory;
  17. $container = new Container((new DefinitionSourceFactory())());
  18. return ApplicationContext::setContainer($container);