PHP code example of corneltek / universal

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

    

corneltek / universal example snippets


    $response = new Universal\Http\StreamResponse;
    for( $i = 0 ; $i < 30000 ; $i++ ) {
        $response->write(json_encode(array('i' => $i)), array(
            'Content-Type' => 'application/json',
        ));
        usleep(200000);
    }
    $response->finish();



$req = new HttpRequest;
foreach( $req->files as $f ) {
    $extname = $f->getExtension();
    $filename = $f->getPathname();
}

$req->param( 'username' );   // get $_REQUEST['username'];

$req->get->username;    // get $_GET['username'];

$req->post->username;   // get $_POST['username'];

$req->server->path_info;  // get $_SERVER['path_info'];