hyperf.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env php
  2. <?php
  3. /**
  4. * This file is part of Hyperf.
  5. *
  6. * @link https://www.hyperf.io
  7. * @document https://hyperf.wiki
  8. * @contact group@hyperf.io
  9. * @license https://github.com/hyperf/hyperf/blob/master/LICENSE
  10. */
  11. ini_set('display_errors', 'on');
  12. ini_set('display_startup_errors', 'on');
  13. ini_set('memory_limit', '1G');
  14. // ..................ID
  15. define('SERVER_RUN_ID', uniqid());
  16. define('EVENT_TALK','onTalk');
  17. define('EVENT_TALK_KEYBOARD', 'onKeyboard');
  18. error_reporting(E_ALL);
  19. ! defined('BASE_PATH') && define('BASE_PATH', dirname(__DIR__, 1));
  20. require BASE_PATH . '/vendor/autoload.php';
  21. ! defined('SWOOLE_HOOK_FLAGS') && define('SWOOLE_HOOK_FLAGS', Hyperf\Engine\DefaultOption::hookFlags());
  22. // Self-called anonymous function that creates its own scope and keep the global namespace clean.
  23. (function () {
  24. Hyperf\Di\ClassLoader::init();
  25. /** @var Psr\Container\ContainerInterface $container */
  26. $container = require BASE_PATH . '/config/container.php';
  27. $application = $container->get(Hyperf\Contract\ApplicationInterface::class);
  28. $application->run();
  29. })();