ConfigProvider.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. declare(strict_types=1);
  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. namespace Hyperf\Server;
  12. use Hyperf\Server\Command\StartServer;
  13. use Hyperf\Server\Listener\AfterWorkerStartListener;
  14. use Hyperf\Server\Listener\InitProcessTitleListener;
  15. use Hyperf\Server\Listener\StoreServerNameListener;
  16. use Swoole\Server as SwooleServer;
  17. class ConfigProvider
  18. {
  19. public function __invoke(): array
  20. {
  21. return [
  22. 'dependencies' => [
  23. SwooleServer::class => SwooleServerFactory::class,
  24. ],
  25. 'listeners' => [
  26. StoreServerNameListener::class,
  27. AfterWorkerStartListener::class,
  28. InitProcessTitleListener::class,
  29. ],
  30. 'commands' => [
  31. StartServer::class,
  32. ],
  33. 'publish' => [
  34. [
  35. 'id' => 'config',
  36. 'description' => 'The config for server.',
  37. 'source' => __DIR__ . '/../publish/server.php',
  38. 'destination' => BASE_PATH . '/config/autoload/server.php',
  39. ],
  40. ],
  41. ];
  42. }
  43. }