rawphp/raw-request

RawRequest is a simple request class used by RawPHP framework and other applications and provides a useful interface to the HTTP request.

dev-master / 0.x-dev 2014-12-17 20:05 UTC

This package is auto-updated.

Last update: 2024-03-20 07:13:30 UTC


README

Build Status Coverage Status Latest Stable Version Total Downloads Latest Unstable Version License

SensioLabsInsight

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.

Add "rawphp/raw-request": "0.*@dev" to the require block in your composer.json and then run composer install.

{
        "require": {
            "rawphp/raw-request": "0.*@dev"
        }
}

You can also simply run the following from the command line:

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.

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.

Contributing

Please submit bug reports, suggestions and pull requests to the GitHub issue tracker.

Changelog

22-09-2014

  • Tested to PHP 5.3.

20-09-2014

  • Replaced php array configuration with yaml

12-09-2014

  • Initial Code Commit