PHP code example of beta / bitrix-psr7

1. Go to this page and download the library: Download beta/bitrix-psr7 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/ */

    

beta / bitrix-psr7 example snippets


/**
 * @var \Bitrix\Main\HttpRequest $orginalBitrixRequest
 * @var \Bitrix\Main\HttpResponse $originalBitrixResponse
 */
$request = new \BitrixPSR7\Request($orginalBitrixRequest);
$request->getHeader('Content-type');
$request->getHeaderLine('Content-type');

$uri = $request->getUri();
$uri->getHost();
$uri->getPort();
$uri->getPath();

$response = new \BitrixPSR7\Response($originalBitrixResponse);
$response->getHeader('Content-type');
$response->getHeaderLine('Content-type');
$response->getStatusCode();
$response->getBody();