{"id":21989199,"url":"https://github.com/micropackage/filesystem","last_synced_at":"2025-04-30T11:28:56.413Z","repository":{"id":53776156,"uuid":"236677812","full_name":"micropackage/filesystem","owner":"micropackage","description":"Wrapper for WordPress' Filesystem for easier file manipulations","archived":false,"fork":false,"pushed_at":"2023-06-23T08:34:23.000Z","size":60,"stargazers_count":19,"open_issues_count":1,"forks_count":5,"subscribers_count":3,"default_branch":"develop","last_synced_at":"2025-04-19T08:51:04.860Z","etag":null,"topics":["bracketspace","composer-library","filesystem","micropackage","wordpress"],"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/micropackage.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}},"created_at":"2020-01-28T07:09:44.000Z","updated_at":"2025-01-03T15:24:13.000Z","dependencies_parsed_at":"2024-06-18T22:53:28.058Z","dependency_job_id":"7c2862f5-e048-4189-9772-1cbc0f129cf0","html_url":"https://github.com/micropackage/filesystem","commit_stats":{"total_commits":28,"total_committers":4,"mean_commits":7.0,"dds":0.3214285714285714,"last_synced_commit":"13920101062fb2409c93aa91ea19e80a0e171658"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropackage%2Ffilesystem","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropackage%2Ffilesystem/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropackage%2Ffilesystem/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/micropackage%2Ffilesystem/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/micropackage","download_url":"https://codeload.github.com/micropackage/filesystem/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251690562,"owners_count":21628144,"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":["bracketspace","composer-library","filesystem","micropackage","wordpress"],"created_at":"2024-11-29T19:28:21.222Z","updated_at":"2025-04-30T11:28:56.366Z","avatar_url":"https://github.com/micropackage.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Filesystem\n\n[![BracketSpace Micropackage](https://img.shields.io/badge/BracketSpace-Micropackage-brightgreen)](https://bracketspace.com)\n[![Latest Stable Version](https://poser.pugx.org/micropackage/filesystem/v/stable)](https://packagist.org/packages/micropackage/filesystem)\n[![PHP from Packagist](https://img.shields.io/packagist/php-v/micropackage/filesystem.svg)](https://packagist.org/packages/micropackage/filesystem)\n[![Total Downloads](https://poser.pugx.org/micropackage/filesystem/downloads)](https://packagist.org/packages/micropackage/filesystem)\n[![License](https://poser.pugx.org/micropackage/filesystem/license)](https://packagist.org/packages/micropackage/filesystem)\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://bracketspace.com/extras/micropackage/micropackage-small.png\" alt=\"Micropackage logo\"/\u003e\n\u003c/p\u003e\n\n## 🧬 About Filesystem\n\nThis micropackage is a wrapper for WordPress filesystem intended to be used within the `wp-content` directory.\n\nSupports:\n- plugins\n- must-use plugins\n- themes\n- custom upload directories\n- custom wp-content directories\n\nThis package will prefix all the relative paths to full paths giving a convinient way to manipulate files.\n\n## 💾 Installation\n\n``` bash\ncomposer require micropackage/filesystem\n```\n\n## 🕹 Usage\n\nInitializing the Filesystem class from the main plugin/theme file. It just needs a base directory.\n\n```php\nuse Micropackage\\Filesystem\\Filesystem;\n\n$filesystem = new Filesystem( __DIR__ );\n```\n\nUsing the micropackage to obtain full paths (plugin example).\n\n```php\necho $filesystem-\u003epath();\n// /var/www/html/wp-content/plugins/my-plugin/\n\necho $filesystem-\u003epath( 'src/templates/full-width.php' );\n// /var/www/html/wp-content/plugins/my-plugin/src/templates/full-width.php\n```\n\nUsing the micropackage to obtain full URL (plugin example).\n\n```php\necho $filesystem-\u003eurl();\n// https://my.plugin/wp-content/plugins/my-plugin/\n\necho $filesystem-\u003eurl( 'assets/images/logo.svg' );\n// https://my.plugin/wp-content/plugins/my-plugin/assets/images/logo.svg\n```\n\nConvert image file to base64 URL.\n\n```php\nprintf( '\u003cimg src=\"%s\"\u003e', $filesystem-\u003eimage_to_base64( 'assets/images/logo.svg' ) );\n// \u003cimg src=\"data:image/svg+xml;base64,m8q76v7wy4guiev...\"\u003e\n```\n\nOn top of that, you can use any method provided by WP_Filesystem class, which includes:\n- `get_contents()`\n- `exists()`\n- `is_file()`, `is_dir()`\n- `mkdir()`\n- `delete()`\n- ...\n\n[See all available methods](https://developer.wordpress.org/reference/classes/wp_filesystem_base/#methods)\n\n## 📦 About the Micropackage project\n\nMicropackages - as the name suggests - are micro packages with a tiny bit of reusable code, helpful particularly in WordPress development.\n\nThe aim is to have multiple packages which can be put together to create something bigger by defining only the structure.\n\nMicropackages are maintained by [BracketSpace](https://bracketspace.com).\n\n## 📖 Changelog\n\n[See the changelog file](./CHANGELOG.md).\n\n## 📃 License\n\nThis software is released under MIT license. See the [LICENSE](./LICENSE) file for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicropackage%2Ffilesystem","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicropackage%2Ffilesystem","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicropackage%2Ffilesystem/lists"}