PHP code example of eserozvataf / scabbia2-lightstack
1. Go to this page and download the library: Download eserozvataf/scabbia2-lightstack 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/ */
eserozvataf / scabbia2-lightstack example snippets
use Scabbia\LightStack\Request;
$request = Request::generateFromGlobals();
// full url in scheme://host:port/directory/ format
echo $request->getEndpoint();
// http method
echo $request->getFormat();
// path info
echo $request->getPathInfo();
// remote ip
echo $request->getRemoteIp();
// is ajax request?
var_dump($request->isAsynchronous());
// instead of $_GET['p']
echo $request->get('p');
// or $_POST['p']
echo $request->post('p');
// or $_FILES['p']
var_dump($request->file('p'));
// or $_GET['p'] || $_POST['p'] || $_FILES['p']
echo $request->data('p');
// or $_SERVER['REQUEST_METHOD'];
echo $request->server('REQUEST_METHOD');
// or $_SESSION['p']
echo $request->session('p');
// or $_COOKIE['p']
echo $request->cookie('p');
// from http headers
echo $request->header('Accept-Language');
// check if a value with key 'p' is posted
var_dump($request->has('post', 'p'));
// check if a file with key 'p' is uploaded
var_dump($request->has('file', 'p'));
// retrieve all posted values
print_r($request->all('post'));
// retrieve all values in request
print_r($request->all());