Skip to content

Commit

Permalink
Merge branch 'parent'
Browse files Browse the repository at this point in the history
# Conflicts:
#	config/autoload/dependencies.php
#	config/autoload/listeners.php
#	config/autoload/logger.php
  • Loading branch information
limingxinleo committed Jan 17, 2024
2 parents b3dfb63 + c203b2f commit 57eb4e3
Show file tree
Hide file tree
Showing 15 changed files with 112 additions and 62 deletions.
15 changes: 11 additions & 4 deletions bin/hyperf.php
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.
*
Expand All @@ -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');

Expand All @@ -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();
})();
46 changes: 23 additions & 23 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions config/autoload/annotations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => [
Expand All @@ -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',
],
],
];
4 changes: 3 additions & 1 deletion config/autoload/async_queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 5 additions & 2 deletions config/autoload/cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:',
],
];
4 changes: 3 additions & 1 deletion config/autoload/databases.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -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,
Expand Down
17 changes: 13 additions & 4 deletions config/autoload/dependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@
* @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 App\Service\Factory\WeChatFactory;
use EasyWeChat\MiniApp\Contracts\Application;
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,
EasyWeChat\MiniApp\Contracts\Application::class => App\Service\Factory\WeChatFactory::class,
StdoutLoggerInterface::class => LoggerFactory::class,
AfterWorkerStartListener::class => WorkerStartListener::class,
EventDispatcherInterface::class => EventDispatcherFactory::class,
Application::class => WeChatFactory::class,
];
4 changes: 3 additions & 1 deletion config/autoload/exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
],
];
10 changes: 7 additions & 3 deletions config/autoload/listeners.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use Hyperf\Command\Listener\FailToHandleListener;
use Hyperf\ExceptionHandler\Listener\ErrorExceptionHandler;
use Hyperf\RPCLogListener\RPCEventListener;

return [
Hyperf\ExceptionHandler\Listener\ErrorExceptionHandler::class,
Hyperf\Command\Listener\FailToHandleListener::class,
Hyperf\RPCLogListener\RPCEventListener::class,
ErrorExceptionHandler::class,
FailToHandleListener::class,
RPCEventListener::class,
];
17 changes: 10 additions & 7 deletions config/autoload/logger.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@
* @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',
'stream' => 'php://output',
'level' => Monolog\Level::Info,
'stream' => BASE_PATH . '/runtime/logs/hyperf.log',
// 'stream' => 'php://output',
'level' => Level::Info,
],
],
'formatter' => [
'class' => Monolog\Formatter\LineFormatter::class,
'class' => LineFormatter::class,
'constructor' => [
'format' => null,
'dateFormat' => 'Y-m-d H:i:s',
Expand All @@ -31,7 +34,7 @@
],
'processors' => [
[
'class' => Log\AppendRequestIdProcessor::class,
'class' => AppendRequestIdProcessor::class,
],
],
],
Expand Down
10 changes: 7 additions & 3 deletions config/autoload/middlewares.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
* @contact [email protected]
* @license https://github.com/hyperf/hyperf/blob/master/LICENSE
*/
use App\Middleware\AuthMiddleware;
use Han\Utils\Middleware\RequestHandledDebugMiddleware;
use Hyperf\Validation\Middleware\ValidationMiddleware;

return [
'http' => [
Han\Utils\Middleware\RequestHandledDebugMiddleware::class,
Hyperf\Validation\Middleware\ValidationMiddleware::class,
App\Middleware\AuthMiddleware::class,
RequestHandledDebugMiddleware::class,
ValidationMiddleware::class,
AuthMiddleware::class,
],
];
4 changes: 3 additions & 1 deletion config/autoload/processes.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
];
Loading

0 comments on commit 57eb4e3

Please sign in to comment.