eserozvataf / scabbia2-lightstack
Scabbia2 LightStack Component
Installs: 26
Dependents: 1
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 0
Open Issues: 2
pkg:composer/eserozvataf/scabbia2-lightstack
Requires
- php: >=5.6.0
Requires (Dev)
This package is auto-updated.
Last update: 2023-09-08 20:32:12 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.
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.