scabbiafw/scabbia2-lightstack

This package is abandoned and no longer maintained. The author suggests using the eserozvataf/scabbia2-lightstack package instead.

Scabbia2 LightStack Component

v0.1.2 2015-09-19 18:58 UTC

This package is not auto-updated.

Last update: 2022-02-01 12:38:03 UTC


README

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.

Build Status Scrutinizer Code Quality Total Downloads Latest Stable Version Latest Unstable Version Documentation Status

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.

  • 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: Donate