PHP code example of alexya-framework / http

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

    

alexya-framework / http example snippets




$request = new \Alexya\Http\Request(
    $_SERVER["REQUEST_URI"],
    $_GET,
    $_POST,
    $_COOKIES,
    $_FILES,
    $_SERVER
); // Which is the same as `$request = \Alexya\Http\Request::main();`

echo $request->get["param_name"];

foreach($request->headers as $key => $value) {
    echo "Requested header: {$key}: {$value}";
}



$request = new Request();

$request->header("Content-Type", "text/html");
$request->status(200);
$request->body("<h1>Hello World</h1>");

Request::redirect("/Home");