2017 © Pedro Peláez
 

library sniffer

sniff input types

image

shieldfy/sniffer

sniff input types

  • Thursday, August 3, 2017
  • by shieldfy
  • Repository
  • 9 Watchers
  • 10 Stars
  • 810 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 16 % Grown

The README.md

Shieldfy Sniffer

Shieldfy Sniffer is a small composer package to detect the input type , now support 4 types ( integer , string , json , serialize), (*1)

Packagist License Code Climate Travis, (*2)

Installation

Through Composer, (*3)

composer require shieldfy/sniffer

Usage & Examples

$type = (new \Shieldfy\Sniffer\Sniffer)->sniff('12.5'); //number

$type = (new \Shieldfy\Sniffer\Sniffer)->sniff('hello world'); //string

$type = (new \Shieldfy\Sniffer\Sniffer)->sniff(json_encode(['hello'=>1,'world'=>'!'])); //json

$type = (new \Shieldfy\Sniffer\Sniffer)->sniff(serialize(['hello'=>1,'world'=>'!'])); //serialize

//you can add more than value as array
$type = (new \Shieldfy\Sniffer\Sniffer)->sniff(['555','abc']);

//test against particular type
$result = (new \Shieldfy\Sniffer\Sniffer)->is('123456789','number'); //true

//you can register your own sniffer on the runtime
$type = (new \Shieldfy\Sniffer\Sniffer)->register('hello',function($input){
    if(strstr($input,'hello')) 
        return true;
    return false;
})->sniff('say hello world');

note about serialization

Serialize / Unserialize can be danger due to its ability to convert object and it can be used to preform object injection attack. So explicit sniffing not allowed in php version before php 7 thats because php7 offered new options to prevent object serialization see here, (*4)

Contributing

Thank you for considering contributing to this project! Bug reports, feature requests, and pull requests are very welcome., (*5)

Security Vulnerabilities

If you discover a security vulnerability within this project, please send an e-mail to security@shieldfy.com., (*6)

The Versions

03/08 2017

dev-master

9999999-dev https://shieldfy.com

sniff input types

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

detection sniffer shieldfy

03/08 2017

1.1.3

1.1.3.0 https://shieldfy.com

sniff input types

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

detection sniffer shieldfy

01/04 2017

1.1.2

1.1.2.0 https://shieldfy.com

sniff input types

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

detection sniffer shieldfy

01/02 2017

1.1.1

1.1.1.0 https://shieldfy.com

sniff input types

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

detection sniffer shieldfy

26/11 2016

1.1.0

1.1.0.0 https://shieldfy.com

sniff input types

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

detection sniffer shieldfy

23/11 2016

1.0.0

1.0.0.0 https://shieldfy.com

sniff input types

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

detection sniffer shieldfy

23/11 2016

dev-analysis-86nB4n

dev-analysis-86nB4n https://shieldfy.com

sniff input types

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

detection sniffer shieldfy