{"id":20140264,"url":"https://github.com/10quality/wp-file","last_synced_at":"2025-06-15T19:04:52.051Z","repository":{"id":56938082,"uuid":"68844745","full_name":"10quality/wp-file","owner":"10quality","description":"Wordpress File class library that mimics PHP file functionality but uses Wordpress standardized functions. Ideal for theme approval check.","archived":false,"fork":false,"pushed_at":"2023-01-05T16:00:10.000Z","size":11,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"v1.0","last_synced_at":"2025-03-23T20:23:12.066Z","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/10quality.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":"2016-09-21T18:10:49.000Z","updated_at":"2023-01-09T08:16:59.000Z","dependencies_parsed_at":"2023-02-04T07:01:15.997Z","dependency_job_id":null,"html_url":"https://github.com/10quality/wp-file","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10quality%2Fwp-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10quality%2Fwp-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10quality%2Fwp-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/10quality%2Fwp-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/10quality","download_url":"https://codeload.github.com/10quality/wp-file/tar.gz/refs/heads/v1.0","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248085996,"owners_count":21045249,"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-11-13T21:49:55.534Z","updated_at":"2025-04-09T18:23:16.880Z","avatar_url":"https://github.com/10quality.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WordPress File (wrapper class)\n\n[![Latest Stable Version](https://poser.pugx.org/10quality/wp-file/v/stable)](https://packagist.org/packages/10quality/wp-file)\n[![Total Downloads](https://poser.pugx.org/10quality/wp-file/downloads)](https://packagist.org/packages/10quality/wp-file)\n[![License](https://poser.pugx.org/10quality/wp-file/license)](https://packagist.org/packages/10quality/wp-file)\n\nThis small class library facilitates file handling for WordPress custom developments, will provide all functionality to meet WordPress' standards.\n\nFeatures:\n* **Theme Check** ready.\n* Easy to use.\n\n## Installation\n\n### With composer\n\nMake the dependecy required in your project:\n```bash\ncomposer require 10quality/wp-file\n```\n\n### Alternative\n\nDownload or clone the project and load the class with php functions:\n```php\nrequire_once '[PATH TO CLASS]/File.php';\n```\n\n## Usage\n\nThe following example will let you see how to use the class:\n\nCode to replace\n```php\n$filename = __DIR__.'/myfile.txt';\n\n$file = @fopen( $filename, ,'w+' );\n\n$content = fread( $file );\n\nfwrite( $file, $content );\n\nfclose($file);\n```\n\nReplacement:\n```php\nuse TenQuality\\WP\\File;\n\n$filename = __DIR__.'/myfile.txt';\n\n$content = File::auth()-\u003eread( $filename );\n\nFile::auth()-\u003ewrite( $filename, $content );\n```\n\n### Authentication\n\nWordPress will require to authenticate a url in order to validate if filesystem credentials are in place.\n\nIf you need to authenticate a specific url, pass it like this:\n\n```php\nFile::auth( $url )-\u003eread( $filename );\n```\n\n### Other methods\n\n```php\n// Returns bool\n$isFile = File::auth()-\u003eis_file( $filename );\n// Returns bool\n$fileExists = File::auth()-\u003eexists( $filename );\n```\n\n### Folder or Path handling\n\nMethods to handle files:\n```php\n$file = File::auth();\n\n// Use is_dir to check if a path exists or not.\nif ( $file-\u003eis_dir( $path ) )\n    // Use mkdir to create non-existent paths.\n    $file-\u003emkdir( $path );\n// Use rmdir to remove paths.\n$file-\u003ermdir( $path );\n```\n\n### Recomendations\n\nStore your files in the `uploads` folder.\n\n## Coding guidelines\n\nPSR-4.\n\n## LICENSE\n\nThe MIT License (MIT)\n\nCopyright (c) 2016 [10Quality](http://www.10quality.com).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F10quality%2Fwp-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F10quality%2Fwp-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F10quality%2Fwp-file/lists"}