{"id":22859416,"url":"https://github.com/yohn/filewriter","last_synced_at":"2026-02-13T06:15:05.701Z","repository":{"id":264247201,"uuid":"892819350","full_name":"Yohn/FileWriter","owner":"Yohn","description":"Simple PHP file writing class","archived":false,"fork":false,"pushed_at":"2024-11-22T22:21:05.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T00:04:27.055Z","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/Yohn.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}},"created_at":"2024-11-22T20:56:32.000Z","updated_at":"2024-11-22T22:18:02.000Z","dependencies_parsed_at":"2024-11-22T22:16:17.684Z","dependency_job_id":"d6a74d93-8464-45da-bc8b-702004fd4663","html_url":"https://github.com/Yohn/FileWriter","commit_stats":null,"previous_names":["yohn/filewriter"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2FFileWriter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2FFileWriter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2FFileWriter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2FFileWriter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yohn","download_url":"https://codeload.github.com/Yohn/FileWriter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248868826,"owners_count":21174754,"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-13T09:06:53.438Z","updated_at":"2026-02-13T06:15:05.647Z","avatar_url":"https://github.com/Yohn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FileWriter PHP Utility\n\n## Overview\n\nThe `FileWriter` class provides a simple and robust utility for writing content to files with various operations like overwriting, appending, and prepending.\n\n## Installation\n\nInstall via Composer:\n```bash\ncomposer require yohns/filewriter\n```\n\n## Requirements\n\n- PHP 7.4+\n- Ext-fileinfo recommended\n\n## Usage Examples\n\n### Basic File Writing\n\n```php\nuse Yohns\\Util\\FileWriter;\n\n// Create a new FileWriter instance\n$fileWriter = new FileWriter('path/to/your/file.txt');\n\n// Overwrite file content\n$fileWriter-\u003eoverwrite(\"Hello, world!\\n\");\n\n// Append to file\n$fileWriter-\u003eappend(\"Additional content\\n\");\n\n// Prepend to file\n$fileWriter-\u003eprepend(\"Initial content\\n\");\n```\n\n### Handling File Operations\n\n```php\n$fileWriter = new FileWriter('logs/app.log');\n\n// Safely write content, with error handling\nif (!$fileWriter-\u003eappend(\"Log entry: \" . date('Y-m-d H:i:s') . \"\\n\")) {\n    // Handle writing error\n    error_log(\"Could not write to log file\");\n}\n```\n\n## Features\n\n- Automatic directory creation\n- File creation if not exists\n- Overwrite, append, and prepend operations\n- File locking to prevent race conditions\n\n## Error Handling\n\nMethods return boolean values:\n- `true`: Operation successful\n- `false`: Operation failed\n\n## License\n\nMIT License","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyohn%2Ffilewriter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyohn%2Ffilewriter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyohn%2Ffilewriter/lists"}