2017 © Pedro Peláez
 

windwalker-package io

Windwalker IO package

image

windwalker/io

Windwalker IO package

  • Sunday, July 8, 2018
  • by asika32764
  • Repository
  • 3 Watchers
  • 0 Stars
  • 4,587 Installations
  • PHP
  • 3 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 52 Versions
  • 9 % Grown

The README.md

Windwalker IO

Windwalker IO package is an input & output handler to get request or send output to user terminal., (*1)

This package is heavily based on Joomla Input but has modified a lot, please see original concept of Joomla Wiki., (*2)

Installation via Composer

Add this to the require block in your composer.json., (*3)

``` json { "require": { "windwalker/io": "~3.0" } }, (*4)


## 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. ``` php use Windwalker\IO\Input; $input = new Input; $input->get('flower'); // Same as $_REQUEST['flower'] $input->set('flower', 'sakura');

The second argument is default value if request params not exists, (*5)

``` php $input->get('flower', 'default');, (*6)


### Filter Input use [Windwalker Filter](https://github.com/ventoviro/windwalker-filter) package to clean request string, the default filter type is `CMD`. We can use other filter type: ``` php // mysite.com/?flower=

to be, or not to be., (*7)

; $input->get('flower'); // tobeornottobe (Default cmd filter) $input->get('flower', 'default_value', InputFilter::STRING); // to be, or not to be $input->getString('flower'); // to be, or not to be (Same as above, using magic method) $input->getRaw('flower') //

to be, or not to be., (*8)

More filter usage please see: Windwalker Filter, (*9)

Compact and Get Array

Get data as an array., (*10)

``` php // mysite.com/?flower[1]=sakura&flower[2]=olive;, (*11)

$input->getArray('flower'); // Array( [1] => sakura [2] => olive), (*12)

// Get array and filter every values $input->getArray('flower', null, '.', 'int');, (*13)


Use `compact()` method ``` php // mysite.com/?flower=sakura&foo=bar&king=Richard // Get all request $input->compact(); // To retrieve values you want $array( 'flower' => '', 'king' => '', ); $input->compact($array); // Array( [flower] => sakura [king] => Richard) // Specify different filters for each of the inputs: $array( 'flower' => InputFilter::CMD, 'king' => InputFilter::STRING, ); // Use nested array to get more complicated hierarchies of values $input->compact(array( 'windwalker' => array( 'title' => InputFilter::STRING, 'quantity' => InputFilter::INTEGER, 'state' => 'integer' // Same as above ) ));

Get And Set Multi-Level

If we want to get value of foo[bar][baz], just use get('foo.bar.baz'):, (*14)

``` php $value = $input->get('foo.bar.baz', 'default', InputFilter::STRING);, (*15)

$input->set('foo.bar.baz', $data);, (*16)

// Use custom separator $input->get('foo/bar/baz', 'default', [filter], '/'); $input->set('foo/bar/baz', $data, '/');, (*17)


### Get Value From Other Methods We can get other methods as a new input object. ``` php $post = $input->post; $value = $post->get('foo', 'bar'); // Other inputs $get = $input->get; $put = $input->put; $delete = $input->delete;

Get SUPER GLOBALS

``` php $env = $input->env; $session = $input->session; $cookie = $input->cookie; $server = $input->server;, (*18)

$server->get('REMOTE_ADDR'); // Same as $_SERVER['REMOTE_ADDR'];, (*19)


See: [SUPER GLOBALS](http://php.net/manual/en/language.variables.superglobals.php) ### Get method of current request: ``` php $method = $input->getMethod();

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., (*20)

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., (*21)

Suppose you have a form like:, (*22)

``` html , (*23)


Normally, PHP would put these in an array called `$_FILES` that looked like:

Array ( [flower] => Array ( [name] => Array ( [test] => Array ( [0] => youtube_icon.png [1] => Younger_Son_2.jpg ) ) [type] => Array ( [test] => Array ( [0] => image/png [1] => image/jpeg ) ) [tmp_name] => Array ( [test] => Array ( [0] => /tmp/phpXoIpSD [1] => /tmp/phpWDE7ye ) ) [error] => Array ( [test] => Array ( [0] => 0 [1] => 0 ) ) [size] => Array ( [test] => Array ( [0] => 34409 [1] => 99529 ) ) ) ), (*24)


FilesInput produces a result that is cleaner and easier to work with: ``` php $files = $input->files->get('flower');

$files then becomes:, (*25)

Array
(
    [test] => Array
        (
            [0] => Array
                (
                    [name] => youtube_icon.png
                    [type] => image/png
                    [tmp_name] => /tmp/phpXoIpSD
                    [error] => 0
                    [size] => 34409
                )

            [1] => Array
                (
                    [name] => Younger_Son_2.jpg
                    [type] => image/jpeg
                    [tmp_name] => /tmp/phpWDE7ye
                    [error] => 0
                    [size] => 99529
                )

        )
)

CLI Input & Output

Please see Cli README, (*26)

The Versions

08/07 2018

dev-master

9999999-dev https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+ LGPL-2.0-or-later

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

08/07 2018

3.4.3

3.4.3.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0-or-later

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

08/07 2018

3.4.4

3.4.4.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0-or-later

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

16/06 2018

3.4.2

3.4.2.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0-or-later

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

15/06 2018

3.4.1

3.4.1.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0-or-later

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

20/02 2018

dev-test

dev-test https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+ LGPL-2.0-or-later

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

20/02 2018

3.3

3.3.0.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0-or-later

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

20/02 2018

3.3.1

3.3.1.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0-or-later

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

20/02 2018

3.3.2

3.3.2.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0-or-later

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

20/02 2018

3.4

3.4.0.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0-or-later

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

15/07 2017

3.2.5

3.2.5.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

15/07 2017

3.2.6

3.2.6.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

15/07 2017

3.2.7

3.2.7.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

15/07 2017

3.2.8

3.2.8.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

25/06 2017

3.2.4

3.2.4.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

10/06 2017

3.2.2

3.2.2.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

10/06 2017

3.2.3

3.2.3.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

05/06 2017

3.2.1

3.2.1.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

05/06 2017

3.2

3.2.0.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.5.9

 

The Development Requires

framework io windwalker

21/03 2017

3.1.4

3.1.4.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

21/03 2017

3.1.5

3.1.5.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

21/03 2017

3.1.6

3.1.6.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

19/11 2016

3.1.3

3.1.3.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

11/10 2016

3.1.1

3.1.1.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

11/10 2016

3.1.2

3.1.2.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

11/10 2016

3.1

3.1.0.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

07/10 2016

3.0.1

3.0.1.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

18/07 2016

3.0

3.0.0.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

06/07 2016

3.0-beta2

3.0.0.0-beta2 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

04/07 2016

3.0-beta

3.0.0.0-beta https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

08/03 2016

2.1.7

2.1.7.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

08/03 2016

2.1.8

2.1.8.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

08/03 2016

2.1.9

2.1.9.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

06/01 2016

2.1.5

2.1.5.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

06/01 2016

2.1.6

2.1.6.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

15/08 2015

2.1.1

2.1.1.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

15/08 2015

2.1.2

2.1.2.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

15/08 2015

2.1.4

2.1.4.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

11/08 2015

2.1

2.1.0.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

27/07 2015

2.0.9

2.0.9.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

23/02 2015

2.0.6

2.0.6.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

23/02 2015

2.0.7

2.0.7.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

23/02 2015

2.0.8

2.0.8.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

16/12 2014

2.0.0

2.0.0.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

16/12 2014

2.0.1

2.0.1.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

16/12 2014

2.0.2

2.0.2.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

16/12 2014

2.0.3

2.0.3.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

16/12 2014

2.0.4

2.0.4.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

16/12 2014

2.0.5

2.0.5.0 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

25/11 2014

2.0.0-beta2

2.0.0.0-beta2 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

LGPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

05/10 2014

2.0.0-beta1

2.0.0.0-beta1 https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker

05/10 2014

2.0.0-alpha

2.0.0.0-alpha https://github.com/ventoviro/windwalker-io

Windwalker IO package

  Sources   Download

GPL-2.0+

The Requires

  • php >=5.3.10

 

The Development Requires

framework io windwalker