1. Go to this page and download the library: Download romeoz/rock-request 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/ */
romeoz / rock-request example snippets
use rock\request\Request;
// example url: http://site.com/foo/?page=1&foo[bar]=test
// returns relative URL
(new Request)->getUrl(); // output: /foo/?page=1&foo[bar]=test
// returns host
(new Request)->getHost(); // output: site.com
// returns query params
(new Request)->rawGet(); // output: ['page' => 1, 'foo' => ['bar' => 'test']]
// returns query params as multiple
(new Request)->rawGet(['foo', 'bar']); // output: test
// alternative approach
(new Request)->rawGet('foo.bar'); // output: test