PHP Class Google\Cloud\ServiceBuilder

This API aims to expose access to these services in a way that is intuitive and easy to use for PHP enthusiasts. The ServiceBuilder instance exposes factory methods which grant access to the various services contained within the API. Configuration is simple. Pass in an array of configuration options to the constructor up front which can be shared between clients or specify the options for the specific services you wish to access, e.g. Datastore, or Storage. Please note that unless otherwise noted the examples below take advantage of Application Default Credentials.
Datei anzeigen Open project: GoogleCloudPlatform/gcloud-php Class Usage Examples

Public Methods

Method Description
__construct ( array $config = [] ) Pass in an array of configuration options which will be shared between clients.
bigQuery ( array $config = [] ) : BigQueryClient Google Cloud BigQuery client. Allows you to create, manage, share and query data. Find more information at Google Cloud BigQuery Docs.
datastore ( array $config = [] ) : DatastoreClient Google Cloud Datastore client. Cloud Datastore is a highly-scalable NoSQL database for your applications. Find more information at Google Cloud Datastore docs.
logging ( array $config = [] ) : LoggingClient Google Stackdriver Logging client. Allows you to store, search, analyze, monitor, and alert on log data and events from Google Cloud Platform and Amazon Web Services. Find more information at Google Stackdriver Logging docs.
naturalLanguage ( array $config = [] ) : NaturalLanguageClient Google Cloud Natural Language client. Provides natural language understanding technologies to developers, including sentiment analysis, entity recognition, and syntax analysis. Currently only English, Spanish, and Japanese textual context are supported. Find more information at Google Cloud Natural Language docs.
pubsub ( array $config = [] ) : PubSubClient Google Cloud Pub/Sub client. Allows you to send and receive messages between independent applications. Find more information at Google Cloud Pub/Sub docs.
speech ( array $config = [] ) : SpeechClient Google Cloud Speech client. Enables easy integration of Google speech recognition technologies into developer applications. Send audio and receive a text transcription from the Cloud Speech API service. Find more information at Google Cloud Speech API docs.
storage ( array $config = [] ) : StorageClient Google Cloud Storage client. Allows you to store and retrieve data on Google's infrastructure. Find more information at Google Cloud Storage API docs.
translate ( array $config = [] ) : TranslateClient Google Translate client. Provides the ability to dynamically translate text between thousands of language pairs. The Google Translate API lets websites and programs integrate with Google Translate API programmatically. Google Translate API is available as a paid service.
vision ( array $config = [] ) : VisionClient Google Cloud Vision client. Allows you to understand the content of an image, classify images into categories, detect text, objects, faces and more. Find more information at Google Cloud Vision docs.

Private Methods

Method Description
resolveConfig ( array $config ) : array Resolves configuration options.

Method Details

__construct() public method

Example: use Google\Cloud\ServiceBuilder; $cloud = new ServiceBuilder([ 'projectId' => 'myAwesomeProject' ]);
public __construct ( array $config = [] )
$config array [optional] { Configuration options. @type string $projectId The project ID from the Google Developer's Console. @type CacheItemPoolInterface $authCache A cache for storing access tokens. **Defaults to** a simple in memory implementation. @type array $authCacheOptions Cache configuration options. @type callable $authHttpHandler A handler used to deliver Psr7 requests specifically for authentication. @type callable $httpHandler A handler used to deliver Psr7 requests. Only valid for requests sent over REST. @type string $keyFile The contents of the service account credentials .json file retrieved from the Google Developer's Console. @type string $keyFilePath The full path to your service account credentials .json file retrieved from the Google Developers Console. @type int $retries Number of retries for a failed request. **Defaults to** `3`. @type array $scopes Scopes to be used for the request. }

bigQuery() public method

Example: $bigQuery = $cloud->bigQuery();
public bigQuery ( array $config = [] ) : BigQueryClient
$config array [optional] { Configuration options. See {@see \Google\Cloud\ServiceBuilder::__construct()} for the other available options. @type bool $returnInt64AsObject If true, 64 bit integers will be returned as a {@see \Google\Cloud\Int64} object for 32 bit platform compatibility. **Defaults to** false.
return Google\Cloud\BigQuery\BigQueryClient

datastore() public method

Example: $datastore = $cloud->datastore();
public datastore ( array $config = [] ) : DatastoreClient
$config array [optional] { Configuration options. See {@see \Google\Cloud\ServiceBuilder::__construct()} for the other available options. @type bool $returnInt64AsObject If true, 64 bit integers will be returned as a {@see \Google\Cloud\Int64} object for 32 bit platform compatibility. **Defaults to** false.
return Google\Cloud\Datastore\DatastoreClient

logging() public method

Example: $logging = $cloud->logging();
public logging ( array $config = [] ) : LoggingClient
$config array [optional] Configuration options. See {@see \Google\Cloud\ServiceBuilder::__construct()} for the available options.
return Google\Cloud\Logging\LoggingClient

naturalLanguage() public method

Example: $language = $cloud->naturalLanguage();
public naturalLanguage ( array $config = [] ) : NaturalLanguageClient
$config array [optional] Configuration options. See {@see \Google\Cloud\ServiceBuilder::__construct()} for the available options.
return Google\Cloud\NaturalLanguage\NaturalLanguageClient

pubsub() public method

Example: $pubsub = $cloud->pubsub();
public pubsub ( array $config = [] ) : PubSubClient
$config array [optional] { Configuration options. See {@see \Google\Cloud\ServiceBuilder::__construct()} for the other available options. @type string $transport The transport type used for requests. May be either `grpc` or `rest`. **Defaults to** `grpc` if gRPC support is detected on the system.
return Google\Cloud\PubSub\PubSubClient

speech() public method

Example: $speech = $cloud->speech();
public speech ( array $config = [] ) : SpeechClient
$config array [optional] Configuration options. See {@see \Google\Cloud\ServiceBuilder::__construct()} for the available options.
return Google\Cloud\Speech\SpeechClient

storage() public method

Example: $storage = $cloud->storage();
public storage ( array $config = [] ) : StorageClient
$config array [optional] Configuration options. See {@see \Google\Cloud\ServiceBuilder::__construct()} for the available options.
return Google\Cloud\Storage\StorageClient

translate() public method

See the Pricing and FAQ pages for details. Find more information at Google Translate docs. Please note that while Google Translate supports authentication via service account and application default credentials like other Cloud Platform APIs, it also supports authentication via a public API access key. If you wish to authenticate using an API key, follow the before you begin instructions to learn how to generate a key. Example: use Google\Cloud\ServiceBuilder; $builder = new ServiceBuilder([ 'key' => 'YOUR_KEY' ]); $translate = $builder->translate();
public translate ( array $config = [] ) : TranslateClient
$config array [optional] { Configuration options. @type string $key A public API access key. @type string $target The target language to assign to the client. Defaults to `en` (English). @type callable $httpHandler A handler used to deliver Psr7 requests. Only valid for requests sent over REST. @type int $retries Number of retries for a failed request. **Defaults to** `3`. }
return Google\Cloud\Translate\TranslateClient

vision() public method

Example: $vision = $cloud->vision();
public vision ( array $config = [] ) : VisionClient
$config array [optional] Configuration options. See {@see \Google\Cloud\ServiceBuilder::__construct()} for the available options.
return Google\Cloud\Vision\VisionClient