{"id":20954757,"url":"https://github.com/m2mtech/flysystem-stream-wrapper","last_synced_at":"2025-04-07T08:25:46.107Z","repository":{"id":37934268,"uuid":"423567521","full_name":"m2mtech/flysystem-stream-wrapper","owner":"m2mtech","description":"A stream wrapper for Flysystem V2+","archived":false,"fork":false,"pushed_at":"2024-10-20T04:28:53.000Z","size":160,"stargazers_count":18,"open_issues_count":3,"forks_count":9,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-31T07:06:34.457Z","etag":null,"topics":["filesystem","php","streamwrapper"],"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/m2mtech.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-01T18:06:51.000Z","updated_at":"2025-02-26T14:07:25.000Z","dependencies_parsed_at":"2024-06-21T14:10:13.937Z","dependency_job_id":"862d90bf-44dd-47d0-97f3-3603923f0137","html_url":"https://github.com/m2mtech/flysystem-stream-wrapper","commit_stats":{"total_commits":35,"total_committers":6,"mean_commits":5.833333333333333,"dds":0.2571428571428571,"last_synced_commit":"08b7d59ccd351f71dd0116f3b093286cdd15e529"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m2mtech%2Fflysystem-stream-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m2mtech%2Fflysystem-stream-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m2mtech%2Fflysystem-stream-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/m2mtech%2Fflysystem-stream-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/m2mtech","download_url":"https://codeload.github.com/m2mtech/flysystem-stream-wrapper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247617112,"owners_count":20967533,"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":["filesystem","php","streamwrapper"],"created_at":"2024-11-19T01:16:21.921Z","updated_at":"2025-04-07T08:25:46.077Z","avatar_url":"https://github.com/m2mtech.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flysystem Stream Wrapper\n\n[![Author](https://img.shields.io/badge/author-@m2mtech-blue.svg?style=flat-square)](http://www.m2m.at)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n\n---\n\nThis package provides a stream wrapper for Flysystem V2 \u0026 V3.\n\n## Flysystem V1\n\nIf you're looking for Flysystem 1.x support, check out the [twistor/flysystem-stream-wrapper](https://github.com/twistor/flysystem-stream-wrapper).\n\n## Installation\n\n```bash\ncomposer require m2mtech/flysystem-stream-wrapper\n```\n\n## Usage\n\n```php\nuse League\\Flysystem\\Filesystem;\nuse League\\Flysystem\\Local\\LocalFilesystemAdapter;\nuse M2MTech\\FlysystemStreamWrapper\\FlysystemStreamWrapper;\n\n$filesystem = new Filesystem(new LocalFilesystemAdapter('/some/path'));\nFlysystemStreamWrapper::register('fly', $filesystem);\n\nfile_put_contents('fly://filename.txt', $content);\nmkdir('fly://happy_thoughts');\n\nFlysystemStreamWrapper::unregister('fly');\n```\n\nThe stream wrapper implements [`symfony/lock`](https://symfony.com/doc/current/components/lock.html) due to Flysystem V2 not supporting locking. By default, file locking using `/tmp` is used, but you can adjust this through configuration:\n\n```php\nFlysystemStreamWrapper::register('fly', $filesystem, [\n    FlysystemStreamWrapper::LOCK_STORE =\u003e 'flock:///tmp',\n    FlysystemStreamWrapper::LOCK_TTL =\u003e 300,\n]);\n```\n\n### Handling Visibility Issues\n\nSome adaptors might throw exceptions when dealing with visibility. If you encounter such issues, configure the stream wrapper to bypass them:\n\n```php\nFlysystemStreamWrapper::register('fly', $filesystem, [\n    FlysystemStreamWrapper::IGNORE_VISIBILITY_ERRORS =\u003e true,\n]);\n```\n\n### Addressing Directory Issues (`file_exists` / `is_dir`)\n\nSome adaptors might not return dates for the last modified attribute for directories. In such cases, you can enable emulation to achieve the desired behavior:\n\n```php\nFlysystemStreamWrapper::register('fly', $filesystem, [\n    FlysystemStreamWrapper::EMULATE_DIRECTORY_LAST_MODIFIED =\u003e true,\n]);\n```\n\n### Dealing with `is_readable` / `is_writable`\n\nSome filesystem functions depend on the `uid` and `gid` of the user executing PHP. Since a reliable cross-platform method to derive these values isn't available, the wrapper attempts to estimate them. If this fails, set them manually:\n\n```php\nFlysystemStreamWrapper::register('fly', $filesystem, [\n    FlysystemStreamWrapper::UID =\u003e 1000,\n    FlysystemStreamWrapper::GID =\u003e 1000,\n]);\n```\n\nAlternatively, access the parameters for [`PortableVisibilityConverter`](https://flysystem.thephpleague.com/docs/usage/unix-visibility/) directly:\n\n```php\nFlysystemStreamWrapper::register('fly', $filesystem, [\n    FlysystemStreamWrapper::VISIBILITY_FILE_PUBLIC =\u003e 0644,\n    FlysystemStreamWrapper::VISIBILITY_FILE_PRIVATE =\u003e 0600,\n    FlysystemStreamWrapper::VISIBILITY_DIRECTORY_PUBLIC =\u003e 0755,\n    FlysystemStreamWrapper::VISIBILITY_DIRECTORY_PRIVATE =\u003e 0700,\n    FlysystemStreamWrapper::VISIBILITY_DEFAULT_FOR_DIRECTORIES =\u003e Visibility::PRIVATE,\n]);\n```\n\n## Testing\n\nThis package was developed using PHP 7.4 and has been tested for compatibility with PHP versions 7.2 through 8.3.\n\nTo test:\n\n- With PHP installed:\n```bash\ncomposer test\n```\n\n- Inside a Docker environment for PHP 7.4:\n```bash\ndocker compose run php74 composer test\n```\n\n**Note**: PHPUnit v10, used from PHP 8.1 onwards, requires a different config file:\n```bash\ndocker compose run php81 composer test10\n```\n\n## Changelog\n\nFor information on recent changes, refer to the [CHANGELOG](CHANGELOG.md).\n\n## Contributing\n\nFor contribution guidelines, see [CONTRIBUTING](.github/CONTRIBUTING.md).\n\n## Security Vulnerabilities\n\nIf you discover any security vulnerabilities, please follow [our security policy](../../security/policy) for reporting.\n\n## Credits\n\n- This package was inspired by [twistor/flysystem-stream-wrapper](https://github.com/twistor/flysystem-stream-wrapper). Many thanks to [Chris Leppanen](https://github.com/twistor).\n- [All Contributors](../../contributors)\n\n## License\n\nLicensed under the MIT License. See the [License File](LICENSE.md) for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm2mtech%2Fflysystem-stream-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fm2mtech%2Fflysystem-stream-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fm2mtech%2Fflysystem-stream-wrapper/lists"}