1. Go to this page and download the library: Download link1515/http-utils-php5 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/ */
link1515 / http-utils-php5 example snippets
ink1515\HttpUtilsPhp5\Request;
// get the request instance
$request = Request::getInstance();
// get property
$ip = $request->getIp();
$method = $request->getMethod();
// get property of the array format
// ex: https://example.com?name=Lynk&job=developer
$queryString = $request->getQueryString(); // ['name' => 'Lynk', 'job' => 'developer']
// You can specify a key to get a value
$name = $request->getQueryString('name'); // Lynk
// You can even use dot notation to get nested values
// ex: request body: { user: { order: { id: 123 }}}
$orderId = $request->getBody('user.order.id'); // 123
// You can configure the ipHeaderFilterChain by yourself. Headers earlier in the array are adopted first.
Request::setIpHeaderFilterChain([
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'REMOTE_ADDR'
]);
ink1515\HttpUtilsPhp5\Response;
use Link1515\HttpUtilsPhp5\Constant\Status;
Response::json(['message' => 'not found'], Status::NOT_FOUND);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.