PHP code example of remisirdata / l5-google-cloud-storage
1. Go to this page and download the library: Download remisirdata/l5-google-cloud-storage library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
remisirdata / l5-google-cloud-storage example snippets
'gcs' => [
// Select the Google Cloud Storage Disk
'driver' => 'gcs',
// The id of your new service account
'service_account' => '[email protected]',
// The location of the json service account file
'service_account_json' => storage_path() . '/service_account.json',
// The bucket you want this disk to point at (To change with your bucket name)
'bucket' => 'cloud-storage-bucket',
],
// Put a private file on the 'gcs' disk which is a Google Cloud Storage bucket
Storage::disk('gcs')->put('test.png', file_get_contents(storage_path('/app/test.png')));
// Put a public-accessible file on the 'gcs' disk which is a Google Cloud Storage bucket
Storage::disk('gcs')->put(
'test-public.png',
file_get_contents(storage_path('/app/test-public.png')),
\Illuminate\Contracts\Filesystem\Filesystem::VISIBILITY_PUBLIC
);
// Retrieve a file
$file = Storage::disk('gcs')->get('test.png');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.