2017 © Pedro Peláez
 

library input

A simple input class

image

nsbucky/input

A simple input class

  • Wednesday, May 14, 2014
  • by nsbucky
  • Repository
  • 1 Watchers
  • 1 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Input

Lightweight utility package to deal with request input variables. Probably dead, (*1)

PHP 5.4 + only., (*2)

Usage

$input = new \Input\Post(); // Get/Server/Cookie/Env or Your Array using \Input\Container( array );

$value = $input->value('my_post_val', 'default_value');

$bool = $input->has('var1');

$all = $input->all();

$except = $input->except('var1','var2','var3');

$only = $input->only('var1');

Sanitize

$int   = $input->asInt('var1');
$email = $input->asEmail('email_variable');

Validate

$bool = $input->isEmail('email_variable');
$bool = $input->isAlpha('alpha_var');
$bool = $input->notAlpha('number_var');

Files

$files = new \Input\Files();

// get single file
// returns instance of \SplFileInfo
$file = $files->get('filename');

// returns instance of new moved file
$uploadedFile = $file->move('/path/to/dir');

// can rename files
$file->setName('newname');
$uploadedFile = $file->move('/path/to/dir'); // will be named to 'newname'

// can validate the files
$bool = $file->hasExtension('pdf');
$bool = $file->hasExtension(['jpg','png','gif']);
$bool = $file->hasMimeType('pdf');
$bool = $file->hasMimeType(['image/jpeg','image/png']);
$bool = $file->notBiggerThan('1M'); // in bytes or k/m/g/t

The Versions

14/05 2014

dev-master

9999999-dev https://github.com/nsbucky/Input

A simple input class

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-filter *

 

request input sanitize

28/03 2014

1.0

1.0.0.0 https://github.com/nsbucky/Input

A simple input class

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-filter *

 

request input sanitize