{"id":20180754,"url":"https://github.com/webfiori/file","last_synced_at":"2026-06-02T09:01:05.735Z","repository":{"id":40383840,"uuid":"490775514","full_name":"WebFiori/file","owner":"WebFiori","description":"Class library to read, write and, view files in PHP.","archived":false,"fork":false,"pushed_at":"2026-04-25T01:09:11.000Z","size":218,"stargazers_count":3,"open_issues_count":25,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-25T02:32:42.535Z","etag":null,"topics":["base64","decoding","encoding","file","file-system","file-upload","library","php"],"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/WebFiori.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"custom":["https://paypal.me/IbrahimBinAlshikh","https://www.buymeacoffee.com/ibrahimdev"],"ko_fi":"ibrahimdev"}},"created_at":"2022-05-10T16:22:09.000Z","updated_at":"2026-04-25T01:05:05.000Z","dependencies_parsed_at":"2023-12-08T23:21:32.342Z","dependency_job_id":"952547c4-30c6-4c20-a786-148d91053398","html_url":"https://github.com/WebFiori/file","commit_stats":{"total_commits":112,"total_committers":2,"mean_commits":56.0,"dds":0.0982142857142857,"last_synced_commit":"842128f6663bef8665131a4270fff869ec554051"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/WebFiori/file","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebFiori%2Ffile","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebFiori%2Ffile/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebFiori%2Ffile/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebFiori%2Ffile/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WebFiori","download_url":"https://codeload.github.com/WebFiori/file/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WebFiori%2Ffile/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33814312,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-02T02:00:07.132Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["base64","decoding","encoding","file","file-system","file-upload","library","php"],"created_at":"2024-11-14T02:32:48.547Z","updated_at":"2026-06-02T09:01:05.722Z","avatar_url":"https://github.com/WebFiori.png","language":"PHP","funding_links":["https://paypal.me/IbrahimBinAlshikh","https://www.buymeacoffee.com/ibrahimdev","https://ko-fi.com/ibrahimdev"],"categories":[],"sub_categories":[],"readme":"# WebFiori File\n\nA PHP library for file operations, providing an object-oriented abstraction layer for reading, writing, uploading, and serving files with Base64 encoding/decoding, MIME type detection, and chunked file processing.\n\n\u003cp align=\"center\"\u003e\n  \u003ca target=\"_blank\" href=\"https://github.com/WebFiori/file/actions/workflows/php84.yaml\"\u003e\n    \u003cimg src=\"https://github.com/WebFiori/file/actions/workflows/php84.yaml/badge.svg?branch=main\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/WebFiori/file\"\u003e\n    \u003cimg src=\"https://codecov.io/gh/WebFiori/file/branch/main/graph/badge.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://sonarcloud.io/dashboard?id=WebFiori_file\"\u003e\n      \u003cimg src=\"https://sonarcloud.io/api/project_badges/measure?project=WebFiori_file\u0026metric=alert_status\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://packagist.org/packages/webfiori/file\"\u003e\n    \u003cimg src=\"https://img.shields.io/packagist/dt/webfiori/file?color=light-green\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n## Installation\n\n```bash\ncomposer require webfiori/file\n```\n\n## Requirements\n\n- PHP 8.1 or higher\n- `webfiori/jsonx` ^4.0\n\n## Supported PHP Versions\n\n|                                                                                       Build Status                                                                                        |\n|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|\n| \u003ca target=\"_blank\" href=\"https://github.com/WebFiori/file/actions/workflows/php81.yaml\"\u003e\u003cimg src=\"https://github.com/WebFiori/file/actions/workflows/php81.yaml/badge.svg?branch=main\"\u003e\u003c/a\u003e |\n| \u003ca target=\"_blank\" href=\"https://github.com/WebFiori/file/actions/workflows/php82.yaml\"\u003e\u003cimg src=\"https://github.com/WebFiori/file/actions/workflows/php82.yaml/badge.svg?branch=main\"\u003e\u003c/a\u003e |\n| \u003ca target=\"_blank\" href=\"https://github.com/WebFiori/file/actions/workflows/php83.yaml\"\u003e\u003cimg src=\"https://github.com/WebFiori/file/actions/workflows/php83.yaml/badge.svg?branch=main\"\u003e\u003c/a\u003e |\n| \u003ca target=\"_blank\" href=\"https://github.com/WebFiori/file/actions/workflows/php84.yaml\"\u003e\u003cimg src=\"https://github.com/WebFiori/file/actions/workflows/php84.yaml/badge.svg?branch=main\"\u003e\u003c/a\u003e |\n\n## Quick Start\n\n```php\n\u003c?php\nrequire_once 'vendor/autoload.php';\n\nuse WebFiori\\File\\File;\n\n$file = new File('/path/to/document.txt');\n$file-\u003eread();\necho $file-\u003egetRawData();\n```\n\n## Core Classes\n\n- **`File`** — Read, write, create, remove, and serve files. Supports byte-range reads, Base64 encoding/decoding, chunked processing, and JSON serialization.\n- **`FileUploader`** — Handle file uploads with extension validation, size limits, and detailed error reporting.\n- **`UploadedFile`** — Extends `File` with upload-specific properties (upload status, replacement status, error message).\n- **`MIME`** — Static lookup of ~600 file extension to MIME type mappings.\n\n## Examples\n\nThe [examples/](examples/) directory contains runnable PHP scripts covering every feature of the library:\n\n| Example | Description |\n|---------|-------------|\n| [Reading and Writing Files](examples/read-and-write/) | Create, write, read, append, and remove files |\n| [File Information](examples/file-information/) | File metadata: name, extension, MIME, size, timestamps, constructor variants |\n| [Partial Read](examples/partial-read/) | Read specific byte ranges from a file |\n| [Appending Data](examples/appending-data/) | Build up in-memory content with `append()` |\n| [Base64 Encoding](examples/base64-encoding/) | Encode/decode Base64, `writeEncoded()`, `readDecoded()` |\n| [Chunked Processing](examples/chunked-processing/) | Split file data into fixed-size chunks |\n| [Bytes and Hex](examples/bytes-and-hex/) | Convert data to byte arrays and hex strings |\n| [MIME Detection](examples/mime-detection/) | Look up MIME types by extension |\n| [Error Handling](examples/error-handling/) | `FileException` scenarios and how to handle them |\n| [JSON Serialization](examples/json-serialization/) | Convert `File` objects to JSON |\n| [Path Utilities](examples/path-utilities/) | Path normalization, directory creation, file existence checks |\n| [File Upload](examples/file-upload/) | Configure and process uploads with `FileUploader` |\n| [Serving Files](examples/serving-files/) | Serve files over HTTP with proper headers |\n\nEach example has its own README with detailed explanations. Run any example with:\n\n```bash\nphp examples/read-and-write/read-and-write.php\n```\n\n## Testing\n\n```bash\n# Run all tests\ncomposer test\n\n# Run tests with PHPUnit 10\ncomposer test10\n```\n\n## Contributing\n\n1. Fork the repository and create a feature branch\n2. Write tests for new functionality\n3. Follow PSR-12 coding standards\n4. Submit a pull request\n\n## License\n\nMIT — see [LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfiori%2Ffile","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwebfiori%2Ffile","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwebfiori%2Ffile/lists"}