{"id":22092126,"url":"https://github.com/krakphp/stream","last_synced_at":"2025-03-23T23:44:58.788Z","repository":{"id":57009057,"uuid":"88900961","full_name":"krakphp/stream","owner":"krakphp","description":"PHP streams and filtering made easy.","archived":false,"fork":false,"pushed_at":"2017-04-20T23:03:53.000Z","size":7,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-29T06:52:26.683Z","etag":null,"topics":["php-stream","stream","stream-filter"],"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/krakphp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2017-04-20T19:03:27.000Z","updated_at":"2019-12-01T10:32:10.000Z","dependencies_parsed_at":"2022-08-21T14:50:50.477Z","dependency_job_id":null,"html_url":"https://github.com/krakphp/stream","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fstream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fstream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fstream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krakphp%2Fstream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krakphp","download_url":"https://codeload.github.com/krakphp/stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245186925,"owners_count":20574554,"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":["php-stream","stream","stream-filter"],"created_at":"2024-12-01T03:08:24.455Z","updated_at":"2025-03-23T23:44:58.742Z","avatar_url":"https://github.com/krakphp.png","language":"PHP","readme":"# Stream\n\nThis library provides a simple abstraction over php streams and filters enabling developers to manipulate streams with extreme ease.\n\n## Installation\n\nInstall with composer at `krak/stream`\n\n## Usage\n\nThis example shows kind of a kitchen sink example of what filters are available and how to utilize them.\n\n```php\n\u003c?php\n\nuse Krak\\Stream;\nuse Krak\\Crypto;\n\n$key = random_bytes(16);\n$crypt = new Crypto\\OpenSSLCrypt($key);\n\n$src = Stream\\fromStr('abc def ghi jkl');\n$dst = Stream\\toOutput();\nStream\\pipe($src, [\n    Stream\\uppercase(), // utilizes string.toupper filter\n    Stream\\chunkFilter(function($chunk) {\n        return str_replace('ABC', 'XYZ', $chunk);\n    }),\n    Stream\\chunkFilter('str_rot13'), // performs rot13 on stream\n    Stream\\hex(), // performs bin2hex\n    Stream\\encrypt($crypt),\n    Stream\\base64Encode(),\n\n    // below are the inverse functions of above which will undo the transformations\n\n    Stream\\base64Decode(),\n    Stream\\decrypt($crypt),\n    Stream\\unhex(),\n    Stream\\createFilter('string.rot13'), // creates a filter from a registered php filter\n    Stream\\chunkFilter(function($chunk) {\n        return str_replace('XYZ', 'ABC', $chunk);\n    }),\n    Stream\\lowercase(),\n], $dst);\n```\n\nThe output of this would simply be: `abc def ghi jkl`.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakphp%2Fstream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrakphp%2Fstream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrakphp%2Fstream/lists"}