RawRequest - A Simple Http Request Interface Class for PHP Applications
, (*1)
, (*2)
Package Features
- Provides an interface to the current HTTP request
- Help with creating relative and absolute site urls
Installation
Composer
RawRequest is available via Composer/Packagist., (*3)
Add "rawphp/raw-request": "0.*@dev"
to the require block in your composer.json and then run composer install
., (*4)
{
"require": {
"rawphp/raw-request": "0.*@dev"
}
}
You can also simply run the following from the command line:, (*5)
composer require rawphp/raw-request "0.*@dev"
Tarball
Alternatively, just copy the contents of the RawRequest folder into somewhere that's in your PHP include_path
setting. If you don't speak git or just want a tarball, click the 'zip' button at the top of the page in GitHub., (*6)
Basic Usage
<?php
defined( 'BASE_URL' ) || define( 'BASE_URL', 'http://rawphp.org/' );
use RawPHP\RawRequest\Request;
// create new request instance
$request = new Request( );
// initialise request
$request->init( );
// get current route and params
$route = $request->route;
$params = $request->params;
// create a new relative url
$url = $request->createUrl( 'users/get', array( 1 ) );
// or absolute url
$url = $request->createUrl( 'users/get', array( 1 ), TRUE );
License
This package is licensed under the MIT. Read LICENSE for information on the software availability and distribution., (*7)
Contributing
Please submit bug reports, suggestions and pull requests to the GitHub issue tracker., (*8)
Changelog
22-09-2014
20-09-2014
- Replaced php array configuration with yaml
12-09-2014