{"id":22136599,"url":"https://github.com/shieldfy/sniffer","last_synced_at":"2025-07-25T20:33:03.848Z","repository":{"id":57049323,"uuid":"74609018","full_name":"shieldfy/sniffer","owner":"shieldfy","description":"sniff inputs type","archived":false,"fork":false,"pushed_at":"2017-08-03T12:11:58.000Z","size":12,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-18T09:57:36.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shieldfy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-11-23T19:48:53.000Z","updated_at":"2020-04-22T18:24:38.000Z","dependencies_parsed_at":"2022-08-23T19:10:19.562Z","dependency_job_id":null,"html_url":"https://github.com/shieldfy/sniffer","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shieldfy%2Fsniffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shieldfy%2Fsniffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shieldfy%2Fsniffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shieldfy%2Fsniffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shieldfy","download_url":"https://codeload.github.com/shieldfy/sniffer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227616595,"owners_count":17794251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-01T19:23:46.223Z","updated_at":"2024-12-01T19:23:46.980Z","avatar_url":"https://github.com/shieldfy.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Shieldfy Sniffer\n\nShieldfy Sniffer is a small composer package to detect the input type , now support 4 types ( integer , string , json , serialize)\n\n[![Packagist](https://img.shields.io/packagist/v/shieldfy/sniffer.svg?label=Packagist\u0026style=flat-square)](https://packagist.org/packages/shieldfy/sniffer)\n[![License](https://img.shields.io/packagist/l/shieldfy/sniffer.svg?label=License\u0026style=flat-square)](https://github.com/shieldfy/sniffer/blob/master/LICENSE)\n[![Code Climate](https://img.shields.io/codeclimate/github/shieldfy/sniffer.svg)](https://codeclimate.com/github/shieldfy/sniffer)\n[![Travis](https://img.shields.io/travis/shieldfy/sniffer.svg)](https://travis-ci.org/shieldfy/sniffer)\n\n\n\n## Installation\n\nThrough Composer\n\n```\ncomposer require shieldfy/sniffer\n```\n\n\n## Usage \u0026 Examples\n\n```php\n$type = (new \\Shieldfy\\Sniffer\\Sniffer)-\u003esniff('12.5'); //number\n\n$type = (new \\Shieldfy\\Sniffer\\Sniffer)-\u003esniff('hello world'); //string\n\n$type = (new \\Shieldfy\\Sniffer\\Sniffer)-\u003esniff(json_encode(['hello'=\u003e1,'world'=\u003e'!'])); //json\n\n$type = (new \\Shieldfy\\Sniffer\\Sniffer)-\u003esniff(serialize(['hello'=\u003e1,'world'=\u003e'!'])); //serialize\n\n//you can add more than value as array\n$type = (new \\Shieldfy\\Sniffer\\Sniffer)-\u003esniff(['555','abc']);\n\n//test against particular type\n$result = (new \\Shieldfy\\Sniffer\\Sniffer)-\u003eis('123456789','number'); //true\n\n//you can register your own sniffer on the runtime\n$type = (new \\Shieldfy\\Sniffer\\Sniffer)-\u003eregister('hello',function($input){\n\tif(strstr($input,'hello')) \n\t\treturn true;\n\treturn false;\n})-\u003esniff('say hello world');\n\n```\n\n### note about serialization\n\nSerialize / Unserialize can be danger due to its ability to convert object and it can be used to preform object injection attack.\nSo explicit sniffing not allowed in php version before php 7 thats because php7 offered new options to prevent object serialization\nsee [here](http://php.net/unserialize)\n\n## Contributing \n\nThank you for considering contributing to this project!\nBug reports, feature requests, and pull requests are very welcome.\n\n\n## Security Vulnerabilities\n\nIf you discover a security vulnerability within this project, please send an e-mail to security@shieldfy.com.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshieldfy%2Fsniffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshieldfy%2Fsniffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshieldfy%2Fsniffer/lists"}