PHP code example of polymorphine / message

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

    

polymorphine / message example snippets


use Polymorphine\Message\ServerRequest;

$override['get'] = ['id' => 123];
$request = ServerRequest::fromGlobals($override);

use Polymorphine\Message\ServerRequest;
use Polymorphine\Message\ServerData;

$request = new ServerRequest::fromServerData(new ServerData([
    'server' => [...],
    'get'    => [...],
    'post'   => [...],
    'cookie' => [...],
    'files'  => [...]
]));

$serverData    = new ServerData(['files' => $_FILES]);
$uploadedFiles = $serverData->uploadeFiles();

$factory = new UploadedFileFactory(PHP_SAPI);
$file    = $factory->createUploadedFile($stream);