superbalist/flysystem-google-storage
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
google/cloud-storage | v1.42.0 | - | Apache-2.0 | prod | |
league/flysystem | 1.1.10 | - | MIT | prod |
The PHP package 'superbalist/flysystem-google-storage' is a powerful utility that serves as an adapter for Google Cloud Storage. It is designed to work seamlessly with Flysystem, a popular PHP filesystem abstraction tool. This package offers functionalities that enable PHP developers to interact with Google Cloud Storage, performing operations like creating, reading, updating, and deleting files easily.
To utilize the 'superbalist/flysystem-google-storage' in your PHP program, you first need to install it using the Composer command:
composer require superbalist/flysystem-google-storage
Following the successful installation, you will need to import the required classes in your PHP file:
use Google\Cloud\Storage\StorageClient;
use League\Flysystem\Filesystem;
use Superbalist\Flysystem\GoogleStorage\GoogleStorageAdapter;
Next, you will set up the storage client and specify the Google Cloud project ID and the bucket you want to interact with:
$storageClient = new StorageClient([
'projectId' => 'your-project-id',
]);
$bucket = $storageClient->bucket('your-bucket-name');
$adapter = new GoogleStorageAdapter($storageClient, $bucket);
$filesystem = new Filesystem($adapter);
Now that you've set up the filesystem, you can perform various operations like writing, reading, updating files, and more:
// write a file
$filesystem->write('path/to/file.txt', 'contents');
A full list of available operations can be found on the Flysystem API documentations.
The documentation for the 'superbalist/flysystem-google-storage' package is found on its GitHub page. It is inclusive of detailed instructions on how to set up and use the different features offered by the package. The documentation also provides code snippets that help users to better understand and implement the package's functionalities. The API documentation for Flysystem, which this package is designed to work with, is also available at http://flysystem.thephpleague.com/api/.