PHP code example of dleno / hyperf-diy

1. Go to this page and download the library: Download dleno/hyperf-diy library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dleno / hyperf-diy example snippets


Hyperf\HttpMessage\Server\RequestParserInterface::class
    => Dleno\CommonCore\Core\Request\RequestParser::class,
Hyperf\HttpServer\Contract\RequestInterface::class
    => Dleno\CommonCore\Core\Request\Request::class,

Dleno\CommonCore\Middleware\Http\AbstractModuleBeforeMiddleware::class
    => App\Middleware\AppModuleBeforeMiddleware::class,

Dleno\CommonCore\Websocket\Contract\WsBindStrategyInterface::class
    => App\WebSocket\Bind\DefaultWsBindStrategy::class,
Dleno\CommonCore\Websocket\Contract\WsHookInterface::class
    => App\WebSocket\Hook\AppWsHook::class,

use Dleno\CommonCore\Exception\ExceptionHandlerConfig;

return [
    'handler' => ExceptionHandlerConfig::defaultHandlers(
        httpCommonHandlers: [
            App\Exception\Handler\BusinessCommonExceptionHandler::class,
        ],
        wsCommonHandlers: [
            App\WebSocket\Exception\Handler\BusinessCommonWsExceptionHandler::class,
        ],
        httpBeforeDefault: [
            App\Exception\Handler\BusinessOutputExceptionHandler::class,
        ],
        wsBeforeDefault: [
            App\WebSocket\Exception\Handler\BusinessWsOutputExceptionHandler::class,
        ],
    ),
];

Router::addServer('ws', function () {
    Router::get('/', 'Dleno\CommonCore\Websocket\Server\WebSocketEnter');
});
bash
composer analyse