{"id":21819411,"url":"https://github.com/dflydev/dflydev-snort-textorbinary","last_synced_at":"2026-05-19T19:38:25.311Z","repository":{"id":6348864,"uuid":"7585332","full_name":"dflydev/dflydev-snort-textorbinary","owner":"dflydev","description":"[READ-ONLY] Subtree split of Dflydev\\Snort\\TextOrBinary.","archived":false,"fork":false,"pushed_at":"2013-01-13T17:20:09.000Z","size":108,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T10:51:16.218Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"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/dflydev.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":"2013-01-13T06:48:42.000Z","updated_at":"2017-04-01T10:17:25.000Z","dependencies_parsed_at":"2022-07-31T02:38:14.674Z","dependency_job_id":null,"html_url":"https://github.com/dflydev/dflydev-snort-textorbinary","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dflydev/dflydev-snort-textorbinary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-snort-textorbinary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-snort-textorbinary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-snort-textorbinary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-snort-textorbinary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dflydev","download_url":"https://codeload.github.com/dflydev/dflydev-snort-textorbinary/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dflydev%2Fdflydev-snort-textorbinary/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33229374,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-19T15:49:41.270Z","status":"ssl_error","status_checked_at":"2026-05-19T15:49:22.917Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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-11-27T16:19:01.443Z","updated_at":"2026-05-19T19:38:20.280Z","avatar_url":"https://github.com/dflydev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Snort - Text or Binary\n======================\n\nBuffer analysis to determine whether a Buffer is more likely to represent text\nor binary data.\n\n\nRequirements\n------------\n\n * PHP 5.3+\n\n\nInstallation\n------------\n\nThrough [Composer][1] as [dflydev/snort-textorbinary][2].\n\n\nUsage\n-----\n\n```php\n\u003c?php\n\nrequire __DIR__.'/vendor/autoload.php';\n\n$resource = fopen('/path/to/a/file', 'r');\n$bytes = fread($resource, 512);\n\n$buffer = new Dflydev\\Snort\\Buffer\\Buffer;\n$buffer-\u003eaddData($bytes, 0, strlen($bytes));\n\n$sniffer = new Dflydev\\Snort\\TextOrBinary\\TextOrBinarySniffer;\n\nif ($sniffer-\u003eisLikelyText($buffer)) {\n\tprint \"Well, probably text? (as best as we can guess in 512 bytes...)\\n\";\n}\n\nif ($sniffer-\u003eisLikelyBinary($buffer)) {\n\tprint \"Well, probably binary? (as best as we can guess in 512 bytes...)\\n\";\n}\n\nif ($sniffer-\u003eisMostlyAscii($buffer)) {\n    print \"Yup, Mostly ASCII!\\n\";\n}\n\nif ($sniffer-\u003elooksLikeUtf8($buffer)) {\n    print \"Yup, UTF-8!\\n\";\n}\n```\n\n\nLicense\n-------\n\nMIT, see LICENSE.\n\n\nCommunity\n---------\n\nIf you have questions or want to help out, join us in the **#dflydev** channel\non **irc.freenode.net** or mention [@dflydev][4] on Twitter.\n\n\nNot Invented Here\n-----------------\n\nThis work was heavily influenced by [Apache Tika][3].\n\n\n[1]: http://getcomposer.org\n[2]: https://packagist.org/packages/dflydev/snort-textorbinary\n[3]: http://tika.apache.org\n[4]: https://twitter.com/dflydev\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflydev%2Fdflydev-snort-textorbinary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdflydev%2Fdflydev-snort-textorbinary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdflydev%2Fdflydev-snort-textorbinary/lists"}