{"id":15917512,"url":"https://github.com/takuya/php-stringio","last_synced_at":"2026-02-24T03:32:02.782Z","repository":{"id":57064721,"uuid":"398944123","full_name":"takuya/php-stringio","owner":"takuya","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-14T03:47:33.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-22T13:42:08.884Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/takuya.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-08-23T01:54:15.000Z","updated_at":"2025-04-14T03:47:36.000Z","dependencies_parsed_at":"2025-02-09T01:14:05.885Z","dependency_job_id":"4d551b76-22fa-4a41-ad58-bd28f9756059","html_url":"https://github.com/takuya/php-stringio","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/takuya/php-stringio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-stringio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-stringio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-stringio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-stringio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takuya","download_url":"https://codeload.github.com/takuya/php-stringio/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-stringio/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29770767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T03:15:54.600Z","status":"ssl_error","status_checked_at":"2026-02-24T03:15:54.143Z","response_time":75,"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-10-06T18:11:09.726Z","updated_at":"2026-02-24T03:32:02.766Z","avatar_url":"https://github.com/takuya.png","language":"PHP","readme":"# StringIO \n\n![workflow](https://github.com/takuya/php-stringio/actions/workflows/actions.yml/badge.svg)\n\n'string' as IO Stream Object. To avoid large string split into large array. \n\nI know,Needless to say,`SplFileObject('php://memory','w+')` is best, but too much.\n\n\n\n## Installation\n```\ncomposer require takuya/php-stringio\n```\n\n## Usage\n```php\n$sio = new StringIO(\"1234\\n\");\n$sio-\u003ewrite(\"aaaa\\n\");\n$sio-\u003ewrite(\"bbbb\\n\");\n$sio-\u003ewrite(\"cccc\\n\");\n$sio-\u003erewind();\nforeach ( $sio-\u003elines() as $line) {\n  var_dump($line);\n}\n$sio-\u003eclose();\n```\n\n### Same to SplFileObject\n```php\n$sio = new \\SplFileObject('php://memory','w+');\n$sio-\u003efwrite(\"1234\\n\");\n$sio-\u003efwrite(\"aaaa\\n\");\n$sio-\u003efwrite(\"bbbb\\n\");\n$sio-\u003efwrite(\"cccc\\n\");\nforeach ( $sio as $line) {\n  var_dump(trim($line));\n}\nunset($sio);\n```\n[SplFileObject](https://www.php.net/manual/en/class.splfileobject.php) has too much inherited method.\n\n### Differences to SplFileObject\n\n- trim() -- no new line(s such as \"\\r\",\"\\n\")\n- few methods -- no inherited methods\n- f- prefix -- without f-  ( fwrite/write )\n- yield  -- generator in lines()\n- close -- SplFileObject does not have fclose()\n\n### Methods \n\n- StringIO#rewind\n- StringIO#seek\n- StringIO#tell\n- StringIO#resource\n- StringIO#close\n- StringIO#closed\n- StringIO#readline\n- StringIO#gets\n- StringIO#write\n- StringIO#get_contents\n- StringIO#eof\n- StringIO#lines\n- StringIO#get_meta_data\n- StringIO#__toString\n\n\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuya%2Fphp-stringio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakuya%2Fphp-stringio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuya%2Fphp-stringio/lists"}