Download the PHP package windwalker/io without Composer
On this page you can find all versions of the php package windwalker/io. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download windwalker/io
More information about windwalker/io
Files in windwalker/io
Package io
Short Description Windwalker IO package
License LGPL-2.0-or-later
Homepage https://github.com/ventoviro/windwalker-io
Informations about the package io
Windwalker IO
Windwalker IO package is an input & output handler to get request or send output to user terminal.
This package is heavily based on Joomla Input but has modified a lot, please see original concept of Joomla Wiki.
Installation via Composer
Add this to the require block in your composer.json
.
Web Input
Mostly, we will need to get request data from http, the $_GET
, $_POST
or $_REQUEST
provides us these data.
But it is very unsafe if we only use super global variables, the Input object can help us get values from these variables and clean every string.
The second argument is default value if request params not exists
Filter
Input use Windwalker Filter package to clean request string, the default filter type is CMD
.
We can use other filter type:
More filter usage please see: Windwalker Filter
Compact and Get Array
Get data as an array.
Use compact()
method
Get And Set Multi-Level
If we want to get value of foo[bar][baz]
, just use get('foo.bar.baz')
:
Get Value From Other Methods
We can get other methods as a new input object.
Get SUPER GLOBALS
See: SUPER GLOBALS
Get method of current request:
Json Input
If you send a request with json body or content-type: application/json
, you can use $input->json
to
get JsonInput
and parse json values.
Files Input
The format that PHP returns file data in for arrays can at times be awkward, especially when dealing with arrays of files. FilesInput provides a convenient interface for making life a little easier, grouping the data by file.
Suppose you have a form like:
Normally, PHP would put these in an array called $_FILES
that looked like:
FilesInput produces a result that is cleaner and easier to work with:
$files
then becomes:
CLI Input & Output
Please see Cli README
All versions of io with dependencies
ext-json Version *