library scabbia2-lightstack
Scabbia2 LightStack Component
scabbiafw/scabbia2-lightstack
Scabbia2 LightStack Component
- Tuesday, September 22, 2015
- by eserozvataf
- Repository
- 1 Watchers
- 4 Stars
- 161 Installations
- PHP
- 2 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 2 Versions
- 0 % Grown
Scabbia2 LightStack Component
This component is a simple abstraction layer which constructs Middleware
, Request
and Response
concepts will be shared with other components or codes. It's lighter alternative for smyfony's HttpKernel and HttpFoundation., (*1)
, (*2)
Usage
Request Object
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());
Links
Contributing
It is publicly open for any contribution. Bugfixes, new features and extra modules are welcome. All contributions should be filed on the eserozvataf/scabbia2-lightstack repository., (*3)
- To contribute to code: Fork the repo, push your changes to your fork, and submit a pull request.
- To report a bug: If something does not work, please report it using GitHub issues.
- To support: