{"id":13545618,"url":"https://github.com/Superbalist/flysystem-google-cloud-storage","last_synced_at":"2025-04-02T15:31:31.640Z","repository":{"id":1765955,"uuid":"44370843","full_name":"Superbalist/flysystem-google-cloud-storage","owner":"Superbalist","description":"Flysystem Adapter for Google Cloud Storage","archived":false,"fork":false,"pushed_at":"2023-10-31T02:39:42.000Z","size":82,"stargazers_count":266,"open_issues_count":31,"forks_count":106,"subscribers_count":43,"default_branch":"master","last_synced_at":"2025-03-24T13:04:11.512Z","etag":null,"topics":["flysystem","flysystem-adapter","flysystem-google-cloud-storage","google-cloud","google-cloud-platform","google-cloud-storage","google-storage","php","superbalist"],"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/Superbalist.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-16T07:58:24.000Z","updated_at":"2025-01-25T21:37:49.000Z","dependencies_parsed_at":"2024-06-18T10:58:50.423Z","dependency_job_id":null,"html_url":"https://github.com/Superbalist/flysystem-google-cloud-storage","commit_stats":{"total_commits":81,"total_committers":26,"mean_commits":"3.1153846153846154","dds":0.4320987654320988,"last_synced_commit":"68bed35276f49da0bec8b63f5e797808b3c8c1f8"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Superbalist%2Fflysystem-google-cloud-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Superbalist%2Fflysystem-google-cloud-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Superbalist%2Fflysystem-google-cloud-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Superbalist%2Fflysystem-google-cloud-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Superbalist","download_url":"https://codeload.github.com/Superbalist/flysystem-google-cloud-storage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246841805,"owners_count":20842649,"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":["flysystem","flysystem-adapter","flysystem-google-cloud-storage","google-cloud","google-cloud-platform","google-cloud-storage","google-storage","php","superbalist"],"created_at":"2024-08-01T11:01:07.176Z","updated_at":"2025-04-02T15:31:31.600Z","avatar_url":"https://github.com/Superbalist.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# flysystem-google-cloud-storage\n\nA Google Cloud Storage adapter for [flysystem](https://github.com/thephpleague/flysystem) - a PHP filesystem abstraction.\n\n[![Author](http://img.shields.io/badge/author-@superbalist-blue.svg?style=flat-square)](https://twitter.com/superbalist)\n[![Build Status](https://img.shields.io/travis/Superbalist/flysystem-google-cloud-storage/master.svg?style=flat-square)](https://travis-ci.org/Superbalist/flysystem-google-cloud-storage)\n[![StyleCI](https://styleci.io/repos/44370843/shield?branch=style-ci)](https://styleci.io/repos/44370843)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE)\n[![Packagist Version](https://img.shields.io/packagist/v/superbalist/flysystem-google-storage.svg?style=flat-square)](https://packagist.org/packages/superbalist/flysystem-google-storage)\n[![Total Downloads](https://img.shields.io/packagist/dt/superbalist/flysystem-google-storage.svg?style=flat-square)](https://packagist.org/packages/superbalist/flysystem-google-storage)\n\n\n## Installation\n\n```bash\ncomposer require superbalist/flysystem-google-storage\n```\n\n## Integrations\n\nWant to get started quickly? Check out some of these integrations:\n\n* Laravel - https://github.com/Superbalist/laravel-google-cloud-storage\n\n## Usage\n\n```php\nuse Google\\Cloud\\Storage\\StorageClient;\nuse League\\Flysystem\\Filesystem;\nuse Superbalist\\Flysystem\\GoogleStorage\\GoogleStorageAdapter;\n\n/**\n * The credentials will be auto-loaded by the Google Cloud Client.\n *\n * 1. The client will first look at the GOOGLE_APPLICATION_CREDENTIALS env var.\n *    You can use ```putenv('GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json');``` to set the location of your credentials file.\n *\n * 2. The client will look for the credentials file at the following paths:\n * - windows: %APPDATA%/gcloud/application_default_credentials.json\n * - others: $HOME/.config/gcloud/application_default_credentials.json\n *\n * If running in Google App Engine, the built-in service account associated with the application will be used.\n * If running in Google Compute Engine, the built-in service account associated with the virtual machine instance will be used.\n */\n\n$storageClient = new StorageClient([\n    'projectId' =\u003e 'your-project-id',\n]);\n$bucket = $storageClient-\u003ebucket('your-bucket-name');\n\n$adapter = new GoogleStorageAdapter($storageClient, $bucket);\n\n$filesystem = new Filesystem($adapter);\n\n/**\n * The credentials are manually specified by passing in a keyFilePath.\n */\n\n$storageClient = new StorageClient([\n    'projectId' =\u003e 'your-project-id',\n    'keyFilePath' =\u003e '/path/to/service-account.json',\n]);\n$bucket = $storageClient-\u003ebucket('your-bucket-name');\n\n$adapter = new GoogleStorageAdapter($storageClient, $bucket);\n\n$filesystem = new Filesystem($adapter);\n\n// write a file\n$filesystem-\u003ewrite('path/to/file.txt', 'contents');\n\n// update a file\n$filesystem-\u003eupdate('path/to/file.txt', 'new contents');\n\n// read a file\n$contents = $filesystem-\u003eread('path/to/file.txt');\n\n// check if a file exists\n$exists = $filesystem-\u003ehas('path/to/file.txt');\n\n// delete a file\n$filesystem-\u003edelete('path/to/file.txt');\n\n// rename a file\n$filesystem-\u003erename('filename.txt', 'newname.txt');\n\n// copy a file\n$filesystem-\u003ecopy('filename.txt', 'duplicate.txt');\n\n// delete a directory\n$filesystem-\u003edeleteDir('path/to/directory');\n\n// see http://flysystem.thephpleague.com/api/ for full list of available functionality\n```\n\n## Google Storage specifics\n\nWhen using a custom storage uri the bucket name will not prepended to the file path.\n\n```php\n$storageClient = new StorageClient([\n    'projectId' =\u003e 'your-project-id',\n]);\n$bucket = $storageClient-\u003ebucket('your-bucket-name');\n$adapter = new GoogleStorageAdapter($storageClient, $bucket);\n\n// uri defaults to \"https://storage.googleapis.com\"\n$filesystem = new Filesystem($adapter);\n$filesystem-\u003egetUrl('path/to/file.txt');\n// \"https://storage.googleapis.com/your-bucket-name/path/to/file.txt\"\n\n// set custom storage uri\n$adapter-\u003esetStorageApiUri('http://example.com');\n$filesystem = new Filesystem($adapter);\n$filesystem-\u003egetUrl('path/to/file.txt');\n// \"http://example.com/path/to/file.txt\"\n\n// You can also prefix the file path if needed.\n$adapter-\u003esetStorageApiUri('http://example.com');\n$adapter-\u003esetPathPrefix('extra-folder/another-folder/');\n$filesystem = new Filesystem($adapter);\n$filesystem-\u003egetUrl('path/to/file.txt');\n// \"http://example.com/extra-folder/another-folder/path/to/file.txt\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSuperbalist%2Fflysystem-google-cloud-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSuperbalist%2Fflysystem-google-cloud-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSuperbalist%2Fflysystem-google-cloud-storage/lists"}