Google\Cloud\Storage\StorageClient::buckets PHP Method

buckets() public method

Example: $buckets = $storage->buckets(); Get all buckets beginning with the prefix 'album'. $buckets = $storage->buckets([ 'prefix' => 'album' ]); foreach ($buckets as $bucket) { echo $bucket->name() . PHP_EOL; }
See also: https://cloud.google.com/storage/docs/json_api/v1/buckets/list Buckets list API documentation.
public buckets ( array $options = [] ) : Generator
$options array [optional] { Configuration options. @type integer $maxResults Maximum number of results to return per request. @type string $prefix Filter results with this prefix. @type string $projection Determines which properties to return. May be either 'full' or 'noAcl'. @type string $fields Selector which will cause the response to only return the specified fields. }
return Generator
    public function buckets(array $options = [])
    {
        $options['pageToken'] = null;
        do {
            $response = $this->connection->listBuckets($options + ['project' => $this->projectId]);
            foreach ($response['items'] as $bucket) {
                (yield new Bucket($this->connection, $bucket['name'], $bucket));
            }
            $options['pageToken'] = isset($response['nextPageToken']) ? $response['nextPageToken'] : null;
        } while ($options['pageToken']);
    }