1. Go to this page and download the library: Download falgunphp/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/ */
falgunphp / http example snippets
use Falgun\Http\Request;
// build request object from global variables
// eg. $_SERVER, $_GET, $_POST
$request = Request::createFromGlobals();
// get all headers
$request->headers()->all(); //array
// get a specific header
$request->headers()->get('Content_type'); // application/json
// get query data, like $_GET
$request->queryDatas()->get('id');
//get Post Data, like $_POST
$request->postDatas()->get('name');
// get uploaded file list, like $_FILE
$request->files()->all(); // array
// get cookies list, like $_COOKIE
$request->cookies()->all(); // array
use Falgun\Http\Response;
$response = new Response('hello world', 200, 'OK');
// set a header
$response->headers()->set('Content-Type', 'plain/text');
// Response can be built for json too
$response = Response::json(['name' => 'Falgun']);
$response->getBody(); // {"name": "Falgun"}
namespace Falgun\Http\Session;
$session = new Session();
$session->start(); // session started
$session->has('test'); // false
$session->set('test', 'foo');
$session->get('test'); // foo
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.