PHP code example of digphp / psr17

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

    

digphp / psr17 example snippets

 php
$factory = new \DigPHP\Psr17\Factory;

$request = $factory->createRequest(string $method, $uri);
$response = $factory->createResponse(int $code = 200, string $reasonPhrase = '');
$response = $factory->createGeneralResponse(int $code = 200, array $headers = [], string $body = null);
$server_request = $factory->createServerRequest(string $method, $uri, array $serverParams = []);
$stream = $factory->createStream(string $content = '');
$stream = $factory->createStreamFromFile(string $file, string $mode = 'r');
$stream = $factory->createStreamFromResource($resource);
$upload_file = $factory->createUploadedFile(StreamInterface $stream,int $size = null,int $error = \UPLOAD_ERR_OK,string $clientFilename = null,string $clientMediaType = null);
$uri = $factory->createUri(string $uri = '');