Question: What are different ways to access Google Services?
- Using Client Libraries like PHP, Node, Java etc
- Using Gcloud tool command line tool, in this you need to download the cloud SDK which is available for windows, mac and linux.
- Using existing command line, similar to above 2nd point.
Question: Question: How to start with client libraries?
- Set up a "GCP Console project" (Skip, if already done).
https://cloud.google.com/resource-manager/docs/creating-managing-projects
Create or select a project.
Enable the Google Speech-to-Text API for that project.
Create a service account.
Download a private key as JSON (Important, we need this). - Set the environment variable GOOGLE_APPLICATION_CREDENTIALS to the private key JSON file that contains your service account key(which you have downloaded)
- Install the client library
Question: What is price cost for storage?
https://cloud.google.com/storage/pricing-summary/
Question: What are the use cases for storage?
- Media storage for website
- Streaming videos and music
- Mobile app development
- Video transcoding
- General data analytics and compute
- Storage data for Machine learning
- Backup data
Question: What are the use cases for storage?
- Multi-Regional: For highest availability of frequently accessed data
- Regional: For data accessed frequently within a region (cheaper)
- Nearline: data which access once a month (more cheaper)
- Coldline: data which accessed once a year (cheapest)
Question: What is price cost for storage?
https://cloud.google.com/storage/pricing-summary/
Question: Who are the Partners of Google storage?
https://cloud.google.com/storage/partners/
Question: How to setup of Google storage for PHP?
Step 1 Go to folder where you want to install
Step 2 Install composer (Skip if already)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('SHA384', 'composer-setup.php') === '544e09ee996cdf60ece3804abc52599c22b1f40f4323403c44d44fdfdd586475ca9813a858088ffbc1f233e9b180f061') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');"
Step 3: Install the library
php composer.phar require google/cloud-storage
Question: How to create folder in Google cloud?
require_once 'vendor/autoload.php'; use Google\Cloud\Storage\StorageClient; #Setup the Private Key JSON File in Environment $credentialFilePath='private_key_JSON_file.json; putenv('GOOGLE_APPLICATION_CREDENTIALS='.$credentialFilePath); # Your Google Cloud Platform project ID $projectId = 'projectName'; # Instantiates a client $storage = new StorageClient([ 'projectId' => $projectId ]); # The name for the new bucket $bucketName = 'mynew-test-bucket'; # Creates the new bucket $bucket = $storage->createBucket($bucketName);
Question: How to upload file in Google cloud folder?
require_once 'vendor/autoload.php'; use Google\Cloud\Storage\StorageClient; #Setup the Private Key JSON File in Environment $credentialFilePath='private_key_JSON_file.json; putenv('GOOGLE_APPLICATION_CREDENTIALS='.$credentialFilePath); # Your Google Cloud Platform project ID $projectId = 'projectName'; $storage = new StorageClient(); $bucket = $storage->bucket($projectId); # Upload a file to the bucket. $bucket->upload( fopen('/downloaded/file.mp3','r') );
Question: How to delete file from Google cloud folder?
require_once 'vendor/autoload.php'; use Google\Cloud\Storage\StorageClient; #Setup the Private Key JSON File in Environment $credentialFilePath='private_key_JSON_file.json; putenv('GOOGLE_APPLICATION_CREDENTIALS='.$credentialFilePath); # Your Google Cloud Platform project ID $projectId = 'projectName'; $storage = new StorageClient(); $bucket = $storage->bucket($projectId); $object = $bucket->object($sourceFile); $object->delete();
Question: What is office link for gcloud storage?
https://cloud.google.com/storage/
Question: What is Github link for gcloud storage (with PHP)?
https://github.com/GoogleCloudPlatform/google-cloud-php