{"id":13594095,"url":"https://github.com/mpyw-junks/stream-interface-resource","last_synced_at":"2025-04-09T07:30:39.555Z","repository":{"id":36846956,"uuid":"230717113","full_name":"mpyw-junks/stream-interface-resource","owner":"mpyw-junks","description":"Create resource stream from PSR-7 StreamInterface implementation","archived":true,"fork":false,"pushed_at":"2021-11-26T15:22:58.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-02T16:49:50.047Z","etag":null,"topics":["php","psr-7","resource","stream"],"latest_commit_sha":null,"homepage":"","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/mpyw-junks.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":"2019-12-29T07:19:47.000Z","updated_at":"2023-01-28T05:07:27.000Z","dependencies_parsed_at":"2022-08-23T12:20:24.146Z","dependency_job_id":null,"html_url":"https://github.com/mpyw-junks/stream-interface-resource","commit_stats":null,"previous_names":["mpyw/stream-interface-resource"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpyw-junks%2Fstream-interface-resource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpyw-junks%2Fstream-interface-resource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpyw-junks%2Fstream-interface-resource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mpyw-junks%2Fstream-interface-resource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mpyw-junks","download_url":"https://codeload.github.com/mpyw-junks/stream-interface-resource/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223375123,"owners_count":17135310,"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","psr-7","resource","stream"],"created_at":"2024-08-01T16:01:28.619Z","updated_at":"2024-11-06T16:30:18.525Z","avatar_url":"https://github.com/mpyw-junks.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"**DEPRECATED: This package has been abandoned. Use [guzzlehttp/psr7](https://github.com/guzzle/psr7) bulit-in methods instead.**\n\n```php\n\u003c?php\n\nuse GuzzleHttp\\Psr7\\StreamWrapper;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$fp = StreamWrapper::getResource(Utils::streamFor(\"a\\nbcd\\n\"));\n```\n\n-----\n\n# Stream Interface Resource [![Build Status](https://github.com/mpyw/stream-interface-resource/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/mpyw/stream-interface-resource/actions) [![Coverage Status](https://coveralls.io/repos/github/mpyw/stream-interface-resource/badge.svg?branch=master)](https://coveralls.io/github/mpyw/stream-interface-resource?branch=master) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mpyw/stream-interface-resource/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/mpyw/stream-interface-resource/?branch=master)\n\nCreate resource stream from PSR-7 StreamInterface implementation.\n\n## Requirements\n\n- PHP: `^7.1 || ^8.0`\n- [guzzlehttp/psr7](https://github.com/guzzle/psr7): `^1.7`\n\n## Installing\n\n```bash\ncomposer require mpyw/stream-interface-resource\n```\n\n## Usage\n\n### From `StreamInterface`\n\n```php\n\u003c?php\n\nuse Mpyw\\StreamInterfaceResource\\StreamInterfaceResource;\nuse GuzzleHttp\\Psr7\\Utils;\n\n$fp = StreamInterfaceResource::open(Utils::streamFor(\"a\\nbcd\\n\"));\n\nvar_dump(fgets($fp)); // \"a\\n\"\nvar_dump(feof($fp)); // false\n\nvar_dump(fgets($fp)); // \"bcd\\n\"\nvar_dump(feof($fp)); // false (PHP ~7.1), true (PHP ^7.2)\n\nvar_dump(fgets($fp)); // false\nvar_dump(feof($fp)); // true\n```\n\n\n### From String\n\n```php\nStreamInterfaceResource::open(\"a\\nbcd\\n\")\n```\n\n### From Iterator\n\n```php\nStreamInterfaceResource::open(new ArrayIterator([\"a\\n\", \"b\\n\", \"c\\n\"]))\n```\n\n### From Generator\n\n```php\nStreamInterfaceResource::open((function () {\n    for ($i = 0; true; ++$i) {\n        yield \"$i\\n\";\n    }\n})())\n```\n\n## Supported Operations\n\n- `fclose`\n- `feof`\n- `fgets`\n- `fread`\n- `fseek`\n- `ftell`\n- `fwrite`\n- `rewind`\n- `stream_get_contents`\n- `stream_copy_to_stream`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpyw-junks%2Fstream-interface-resource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmpyw-junks%2Fstream-interface-resource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmpyw-junks%2Fstream-interface-resource/lists"}