-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c7084e
commit c203b2f
Showing
13 changed files
with
75 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
|
||
declare(strict_types=1); | ||
/** | ||
* This file is part of Hyperf. | ||
* | ||
|
@@ -8,6 +10,11 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use Hyperf\Contract\ApplicationInterface; | ||
use Hyperf\Di\ClassLoader; | ||
use Psr\Container\ContainerInterface; | ||
use Symfony\Component\Console\Application; | ||
|
||
ini_set('display_errors', 'on'); | ||
ini_set('display_startup_errors', 'on'); | ||
|
||
|
@@ -21,10 +28,10 @@ | |
|
||
// Self-called anonymous function that creates its own scope and keep the global namespace clean. | ||
(function () { | ||
Hyperf\Di\ClassLoader::init(); | ||
/** @var Psr\Container\ContainerInterface $container */ | ||
ClassLoader::init(); | ||
/** @var ContainerInterface $container */ | ||
$container = require BASE_PATH . '/config/container.php'; | ||
/** @var Symfony\Component\Console\Application $application */ | ||
$application = $container->get(Hyperf\Contract\ApplicationInterface::class); | ||
/** @var Application $application */ | ||
$application = $container->get(ApplicationInterface::class); | ||
$application->run(); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,9 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use Hyperf\Coroutine\Coroutine; | ||
use Hyperf\Di\Resolver\ResolverDispatcher; | ||
|
||
return [ | ||
'scan' => [ | ||
'paths' => [ | ||
|
@@ -18,8 +21,8 @@ | |
'mixin', | ||
], | ||
'class_map' => [ | ||
Hyperf\Coroutine\Coroutine::class => BASE_PATH . '/app/Kernel/ClassMap/Coroutine.php', | ||
Hyperf\Di\Resolver\ResolverDispatcher::class => BASE_PATH . '/app/Kernel/ClassMap/ResolverDispatcher.php', | ||
Coroutine::class => BASE_PATH . '/app/Kernel/ClassMap/Coroutine.php', | ||
ResolverDispatcher::class => BASE_PATH . '/app/Kernel/ClassMap/ResolverDispatcher.php', | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,11 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use Hyperf\AsyncQueue\Driver\RedisDriver; | ||
|
||
return [ | ||
'default' => [ | ||
'driver' => Hyperf\AsyncQueue\Driver\RedisDriver::class, | ||
'driver' => RedisDriver::class, | ||
'channel' => '{queue}', | ||
'timeout' => 2, | ||
'retry_seconds' => 5, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,13 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use Hyperf\Cache\Driver\RedisDriver; | ||
use Hyperf\Codec\Packer\PhpSerializerPacker; | ||
|
||
return [ | ||
'default' => [ | ||
'driver' => Hyperf\Cache\Driver\RedisDriver::class, | ||
'packer' => Hyperf\Codec\Packer\PhpSerializerPacker::class, | ||
'driver' => RedisDriver::class, | ||
'packer' => PhpSerializerPacker::class, | ||
'prefix' => 'c:', | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use Hyperf\ModelCache\Handler\RedisHandler; | ||
|
||
use function Hyperf\Support\env; | ||
|
||
return [ | ||
|
@@ -31,7 +33,7 @@ | |
'max_idle_time' => (float) env('DB_MAX_IDLE_TIME', 60), | ||
], | ||
'cache' => [ | ||
'handler' => Hyperf\ModelCache\Handler\RedisHandler::class, | ||
'handler' => RedisHandler::class, | ||
'cache_key' => '{mc:%s:m:%s}:%s:%s', | ||
'prefix' => 'default', | ||
'ttl' => 3600 * 24, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,15 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use App\Kernel\Event\EventDispatcherFactory; | ||
use App\Kernel\Http\WorkerStartListener; | ||
use App\Kernel\Log\LoggerFactory; | ||
use Hyperf\Contract\StdoutLoggerInterface; | ||
use Hyperf\Server\Listener\AfterWorkerStartListener; | ||
use Psr\EventDispatcher\EventDispatcherInterface; | ||
|
||
return [ | ||
Hyperf\Contract\StdoutLoggerInterface::class => App\Kernel\Log\LoggerFactory::class, | ||
Hyperf\Server\Listener\AfterWorkerStartListener::class => App\Kernel\Http\WorkerStartListener::class, | ||
Psr\EventDispatcher\EventDispatcherInterface::class => App\Kernel\Event\EventDispatcherFactory::class, | ||
StdoutLoggerInterface::class => LoggerFactory::class, | ||
AfterWorkerStartListener::class => WorkerStartListener::class, | ||
EventDispatcherInterface::class => EventDispatcherFactory::class, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,12 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use App\Exception\Handler\BusinessExceptionHandler; | ||
|
||
return [ | ||
'handler' => [ | ||
'http' => [ | ||
App\Exception\Handler\BusinessExceptionHandler::class, | ||
BusinessExceptionHandler::class, | ||
], | ||
], | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,10 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use Hyperf\Command\Listener\FailToHandleListener; | ||
use Hyperf\ExceptionHandler\Listener\ErrorExceptionHandler; | ||
|
||
return [ | ||
Hyperf\ExceptionHandler\Listener\ErrorExceptionHandler::class, | ||
Hyperf\Command\Listener\FailToHandleListener::class, | ||
ErrorExceptionHandler::class, | ||
FailToHandleListener::class, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,19 +9,22 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use App\Kernel\Log; | ||
use App\Kernel\Log\AppendRequestIdProcessor; | ||
use Monolog\Formatter\LineFormatter; | ||
use Monolog\Handler\StreamHandler; | ||
use Monolog\Level; | ||
|
||
return [ | ||
'default' => [ | ||
'handler' => [ | ||
'class' => Monolog\Handler\StreamHandler::class, | ||
'class' => StreamHandler::class, | ||
'constructor' => [ | ||
'stream' => BASE_PATH . '/runtime/logs/hyperf.log', | ||
'level' => Monolog\Level::Info, | ||
'level' => Level::Info, | ||
], | ||
], | ||
'formatter' => [ | ||
'class' => Monolog\Formatter\LineFormatter::class, | ||
'class' => LineFormatter::class, | ||
'constructor' => [ | ||
'format' => null, | ||
'dateFormat' => 'Y-m-d H:i:s', | ||
|
@@ -30,7 +33,7 @@ | |
], | ||
'processors' => [ | ||
[ | ||
'class' => Log\AppendRequestIdProcessor::class, | ||
'class' => AppendRequestIdProcessor::class, | ||
], | ||
], | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use Hyperf\AsyncQueue\Process\ConsumerProcess; | ||
|
||
return [ | ||
Hyperf\AsyncQueue\Process\ConsumerProcess::class, | ||
ConsumerProcess::class, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,10 @@ | |
* @contact [email protected] | ||
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE | ||
*/ | ||
use Hyperf\Contract\ApplicationInterface; | ||
use Hyperf\Di\ClassLoader; | ||
use Swoole\Runtime; | ||
|
||
use function Hyperf\Support\swoole_hook_flags; | ||
|
||
error_reporting(E_ALL); | ||
|
@@ -19,10 +23,10 @@ | |
|
||
require BASE_PATH . '/vendor/autoload.php'; | ||
|
||
Swoole\Runtime::enableCoroutine(true, swoole_hook_flags()); | ||
Runtime::enableCoroutine(true, swoole_hook_flags()); | ||
|
||
Hyperf\Di\ClassLoader::init(); | ||
ClassLoader::init(); | ||
|
||
$container = require BASE_PATH . '/config/container.php'; | ||
|
||
$container->get(Hyperf\Contract\ApplicationInterface::class); | ||
$container->get(ApplicationInterface::class); |