diff --git a/bigquery/quickstart/composer.json b/bigquery/quickstart/composer.json new file mode 100644 index 0000000000..c41b6683f5 --- /dev/null +++ b/bigquery/quickstart/composer.json @@ -0,0 +1,6 @@ +{ + "require": { + "php": ">=5.4", + "google/cloud": "0.10" + } +} diff --git a/bigquery/quickstart/composer.lock b/bigquery/quickstart/composer.lock new file mode 100644 index 0000000000..0b6d1c4b50 --- /dev/null +++ b/bigquery/quickstart/composer.lock @@ -0,0 +1,632 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "f75b529e9f42e9c698da7cbb22ae4f13", + "content-hash": "4c7836060be1fc699affa599c19eb06d", + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2015-07-22 18:31:08" + }, + { + "name": "google/auth", + "version": "v0.10", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/760e3fbe4064c0525c22e27e5374eada3c103da8", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0", + "guzzlehttp/guzzle": "~5.3|~6.0", + "guzzlehttp/psr7": "~1.2", + "php": ">=5.4", + "psr/cache": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ], + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2016-08-02 22:00:48" + }, + { + "name": "google/cloud", + "version": "v0.10.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/google-cloud-php.git", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/zipball/ad867d788e855b3423fb8866b15ea23fbe844cbe", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe", + "shasum": "" + }, + "require": { + "google/auth": "0.10", + "guzzlehttp/guzzle": "~5.2|~6.0", + "guzzlehttp/psr7": "^1.2", + "monolog/monolog": "~1", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "james-heinrich/getid3": "^1.9", + "league/json-guard": "^0.3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*", + "symfony/console": "^3.0", + "vierbergenlars/php-semver": "^3.0" + }, + "suggest": { + "google/gax": "Required to support gRPC", + "google/proto-client-php": "Required to support gRPC", + "james-heinrich/getid3": "Allows the Google Cloud Speech client to determine sample rate and encoding of audio inputs" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Cloud\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "John Pedrie", + "email": "john@pedrie.com" + }, + { + "name": "Dave Supplee", + "email": "dwsupplee@gmail.com" + } + ], + "description": "Google Cloud Client Library", + "homepage": "http://github.com/GoogleCloudPlatform/google-cloud-php", + "keywords": [ + "big query", + "bigquery", + "cloud", + "datastore", + "gcs", + "google", + "google api", + "google api client", + "google apis", + "google apis client", + "google cloud", + "google cloud platform", + "natural language", + "pub sub", + "pubsub", + "speech", + "stackdriver logging", + "storage", + "translate", + "vision" + ], + "time": "2016-10-05 15:18:51" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.3.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0", + "psr/log": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-07-15 17:22:37" + }, + { + "name": "guzzlehttp/promises", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-05-18 16:56:05" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2016-06-24 23:00:38" + }, + { + "name": "monolog/monolog", + "version": "1.21.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-07-29 03:23:52" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06 20:24:11" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-09-19 16:02:08" + }, + { + "name": "rize/uri-template", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2496aa674438f1c48fce122ffc44291ad7014717", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Rize\\UriTemplate": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "time": "2015-04-17 16:12:22" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [] +} diff --git a/bigquery/quickstart/phpunit.xml.dist b/bigquery/quickstart/phpunit.xml.dist new file mode 100644 index 0000000000..4cb0382a76 --- /dev/null +++ b/bigquery/quickstart/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + test + + + + + + + + quickstart.php + + + diff --git a/bigquery/quickstart/quickstart.php b/bigquery/quickstart/quickstart.php new file mode 100644 index 0000000000..2a02598a60 --- /dev/null +++ b/bigquery/quickstart/quickstart.php @@ -0,0 +1,26 @@ + $projectId +]); + +# The name for the new dataset +$datasetName = 'my_new_dataset'; + +# Creates the new dataset +$dataset = $bigquery->createDataset($datasetName); + +echo 'Dataset ' . $dataset->id() . ' created.'; +# [END bigquery_quickstart] +return $dataset; diff --git a/logging/test/bootstrap.php b/bigquery/quickstart/test/bootstrap.php similarity index 100% rename from logging/test/bootstrap.php rename to bigquery/quickstart/test/bootstrap.php diff --git a/bigquery/quickstart/test/quickstartTest.php b/bigquery/quickstart/test/quickstartTest.php new file mode 100644 index 0000000000..ddcb7f6c4c --- /dev/null +++ b/bigquery/quickstart/test/quickstartTest.php @@ -0,0 +1,51 @@ +markTestSkipped('GOOGLE_PROJECT_ID must be set.'); + } + + $datasetId = 'my_new_dataset_' . time(); + $file = sys_get_temp_dir() . '/bigquery_quickstart.php'; + $contents = file_get_contents(__DIR__ . '/../quickstart.php'); + $contents = str_replace( + ['YOUR_PROJECT_ID', 'my_new_dataset', '__DIR__'], + [$projectId, $datasetId, sprintf('"%s/.."', __DIR__)], + $contents + ); + file_put_contents($file, $contents); + + // Invoke quickstart.php + $this->dataset = include $file; + + // Make sure it looks correct + $this->assertInstanceOf('Google\Cloud\BigQuery\Dataset', $this->dataset); + $this->assertEquals($datasetId, $this->dataset->id()); + } + + public function tearDown() + { + if ($this->dataset) { + $this->dataset->delete(); + } + } +} diff --git a/datastore/api/src/functions/concepts.php b/datastore/api/src/functions/concepts.php index 87d1245f13..7832962ff0 100644 --- a/datastore/api/src/functions/concepts.php +++ b/datastore/api/src/functions/concepts.php @@ -19,7 +19,6 @@ // [START datastore_use ] use Google\Cloud\Datastore\DatastoreClient; - // [END datastore_use ] use Google\Cloud\Datastore\Key; diff --git a/datastore/quickstart/composer.json b/datastore/quickstart/composer.json new file mode 100644 index 0000000000..c41b6683f5 --- /dev/null +++ b/datastore/quickstart/composer.json @@ -0,0 +1,6 @@ +{ + "require": { + "php": ">=5.4", + "google/cloud": "0.10" + } +} diff --git a/datastore/quickstart/composer.lock b/datastore/quickstart/composer.lock new file mode 100644 index 0000000000..a1206fa15c --- /dev/null +++ b/datastore/quickstart/composer.lock @@ -0,0 +1,631 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "961be53cdb568c9c0c19f48f55b0fa66", + "content-hash": "52daf6d8a20f698e105309ea10a69031", + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2015-07-22 18:31:08" + }, + { + "name": "google/auth", + "version": "v0.10", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/760e3fbe4064c0525c22e27e5374eada3c103da8", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0", + "guzzlehttp/guzzle": "~5.3|~6.0", + "guzzlehttp/psr7": "~1.2", + "php": ">=5.4", + "psr/cache": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ], + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2016-08-02 22:00:48" + }, + { + "name": "google/cloud", + "version": "v0.9.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/google-cloud-php.git", + "reference": "a972770d8f36687dbb34f23df7d6d76027bf2323" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/zipball/a972770d8f36687dbb34f23df7d6d76027bf2323", + "reference": "a972770d8f36687dbb34f23df7d6d76027bf2323", + "shasum": "" + }, + "require": { + "google/auth": "0.10", + "guzzlehttp/guzzle": "~5.2|~6.0", + "guzzlehttp/psr7": "^1.2", + "monolog/monolog": "~1", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "james-heinrich/getid3": "^1.9", + "league/json-guard": "^0.3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*", + "symfony/console": "^3.0" + }, + "suggest": { + "google/gax": "Required to support gRPC", + "google/proto-client-php": "Required to support gRPC", + "james-heinrich/getid3": "Allows the Google Cloud Speech client to determine sample rate and encoding of audio inputs" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Cloud\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "John Pedrie", + "email": "john@pedrie.com" + }, + { + "name": "Dave Supplee", + "email": "dwsupplee@gmail.com" + } + ], + "description": "Google Cloud Client Library", + "homepage": "http://github.com/GoogleCloudPlatform/google-cloud-php", + "keywords": [ + "big query", + "bigquery", + "cloud", + "datastore", + "gcs", + "google", + "google api", + "google api client", + "google apis", + "google apis client", + "google cloud", + "google cloud platform", + "natural language", + "pub sub", + "pubsub", + "speech", + "stackdriver logging", + "storage", + "translate", + "vision" + ], + "time": "2016-09-26 15:59:01" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.3.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0", + "psr/log": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-07-15 17:22:37" + }, + { + "name": "guzzlehttp/promises", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-05-18 16:56:05" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2016-06-24 23:00:38" + }, + { + "name": "monolog/monolog", + "version": "1.21.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-07-29 03:23:52" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06 20:24:11" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-09-19 16:02:08" + }, + { + "name": "rize/uri-template", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2496aa674438f1c48fce122ffc44291ad7014717", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Rize\\UriTemplate": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "time": "2015-04-17 16:12:22" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [] +} diff --git a/datastore/quickstart/phpunit.xml.dist b/datastore/quickstart/phpunit.xml.dist new file mode 100644 index 0000000000..d8fd1e26a4 --- /dev/null +++ b/datastore/quickstart/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + test + + + + + + + + quickstart.php + + + diff --git a/datastore/quickstart/quickstart.php b/datastore/quickstart/quickstart.php new file mode 100644 index 0000000000..b5c8b1b919 --- /dev/null +++ b/datastore/quickstart/quickstart.php @@ -0,0 +1,35 @@ + $projectId +]); + +# The kind for the new entity +$kind = 'Task'; + +# The name/ID for the new entity +$name = 'sampletask1'; + +# The Cloud Datastore key for the new entity +$taskKey = $datastore->key($kind, $name); + +# Prepares the new entity +$task = $datastore->entity($taskKey, ['description' => 'Buy milk']); + +# Saves the entity +$datastore->upsert($task); + +echo 'Saved ' . $task->key() . ': ' . $task['description']; +# [END datastore_quickstart] +return $task; diff --git a/datastore/quickstart/test/bootstrap.php b/datastore/quickstart/test/bootstrap.php new file mode 100644 index 0000000000..6c8c4f51b9 --- /dev/null +++ b/datastore/quickstart/test/bootstrap.php @@ -0,0 +1,3 @@ +markTestSkipped('GOOGLE_PROJECT_ID must be set.'); + } + + $file = sys_get_temp_dir() . '/datastore_quickstart.php'; + $contents = file_get_contents(__DIR__ . '/../quickstart.php'); + $contents = str_replace( + ['YOUR_PROJECT_ID', '__DIR__'], + [$projectId, sprintf('"%s/.."', __DIR__)], + $contents + ); + file_put_contents($file, $contents); + + // Invoke quickstart.php + $entity = include $file; + + // Make sure it looks correct + $this->assertInstanceOf('Google\Cloud\Datastore\Entity', $entity); + $this->assertEquals('sampletask1', $entity->key()->path()[0]['name']); + $this->assertEquals('Buy milk', $entity['description']); + } +} diff --git a/language/quickstart/composer.json b/language/quickstart/composer.json new file mode 100644 index 0000000000..c41b6683f5 --- /dev/null +++ b/language/quickstart/composer.json @@ -0,0 +1,6 @@ +{ + "require": { + "php": ">=5.4", + "google/cloud": "0.10" + } +} diff --git a/language/quickstart/composer.lock b/language/quickstart/composer.lock new file mode 100644 index 0000000000..0b6d1c4b50 --- /dev/null +++ b/language/quickstart/composer.lock @@ -0,0 +1,632 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "f75b529e9f42e9c698da7cbb22ae4f13", + "content-hash": "4c7836060be1fc699affa599c19eb06d", + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2015-07-22 18:31:08" + }, + { + "name": "google/auth", + "version": "v0.10", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/760e3fbe4064c0525c22e27e5374eada3c103da8", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0", + "guzzlehttp/guzzle": "~5.3|~6.0", + "guzzlehttp/psr7": "~1.2", + "php": ">=5.4", + "psr/cache": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ], + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2016-08-02 22:00:48" + }, + { + "name": "google/cloud", + "version": "v0.10.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/google-cloud-php.git", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/zipball/ad867d788e855b3423fb8866b15ea23fbe844cbe", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe", + "shasum": "" + }, + "require": { + "google/auth": "0.10", + "guzzlehttp/guzzle": "~5.2|~6.0", + "guzzlehttp/psr7": "^1.2", + "monolog/monolog": "~1", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "james-heinrich/getid3": "^1.9", + "league/json-guard": "^0.3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*", + "symfony/console": "^3.0", + "vierbergenlars/php-semver": "^3.0" + }, + "suggest": { + "google/gax": "Required to support gRPC", + "google/proto-client-php": "Required to support gRPC", + "james-heinrich/getid3": "Allows the Google Cloud Speech client to determine sample rate and encoding of audio inputs" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Cloud\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "John Pedrie", + "email": "john@pedrie.com" + }, + { + "name": "Dave Supplee", + "email": "dwsupplee@gmail.com" + } + ], + "description": "Google Cloud Client Library", + "homepage": "http://github.com/GoogleCloudPlatform/google-cloud-php", + "keywords": [ + "big query", + "bigquery", + "cloud", + "datastore", + "gcs", + "google", + "google api", + "google api client", + "google apis", + "google apis client", + "google cloud", + "google cloud platform", + "natural language", + "pub sub", + "pubsub", + "speech", + "stackdriver logging", + "storage", + "translate", + "vision" + ], + "time": "2016-10-05 15:18:51" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.3.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0", + "psr/log": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-07-15 17:22:37" + }, + { + "name": "guzzlehttp/promises", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-05-18 16:56:05" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2016-06-24 23:00:38" + }, + { + "name": "monolog/monolog", + "version": "1.21.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-07-29 03:23:52" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06 20:24:11" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-09-19 16:02:08" + }, + { + "name": "rize/uri-template", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2496aa674438f1c48fce122ffc44291ad7014717", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Rize\\UriTemplate": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "time": "2015-04-17 16:12:22" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [] +} diff --git a/language/quickstart/phpunit.xml.dist b/language/quickstart/phpunit.xml.dist new file mode 100644 index 0000000000..fc16fb68da --- /dev/null +++ b/language/quickstart/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + test + + + + + + + + quickstart.php + + + diff --git a/language/quickstart/quickstart.php b/language/quickstart/quickstart.php new file mode 100644 index 0000000000..7742e9bce6 --- /dev/null +++ b/language/quickstart/quickstart.php @@ -0,0 +1,28 @@ + $projectId +]); + +# The text to analyze +$text = 'Hello, world!'; + +# Detects the sentiment of the text +$annotation = $language->analyzeSentiment($text); +$sentiment = $annotation->sentiment(); + +echo 'Text: ' . $text . ' +Sentiment: ' . $sentiment['polarity'] . ', ' . $sentiment['magnitude']; +# [END language_quickstart] +return $sentiment; diff --git a/language/quickstart/test/bootstrap.php b/language/quickstart/test/bootstrap.php new file mode 100644 index 0000000000..6c8c4f51b9 --- /dev/null +++ b/language/quickstart/test/bootstrap.php @@ -0,0 +1,3 @@ +markTestSkipped('GOOGLE_PROJECT_ID must be set.'); + } + + $file = sys_get_temp_dir() . '/language_quickstart.php'; + $contents = file_get_contents(__DIR__ . '/../quickstart.php'); + $contents = str_replace( + ['YOUR_PROJECT_ID', '__DIR__'], + [$projectId, sprintf('"%s/.."', __DIR__)], + $contents + ); + file_put_contents($file, $contents); + + // Invoke quickstart.php + $sentiment = include $file; + + // Make sure it looks correct + $this->assertTrue(is_array($sentiment)); + $this->assertArrayHasKey('polarity', $sentiment); + $this->assertArrayHasKey('magnitude', $sentiment); + $this->assertEquals(1, $sentiment['polarity']); + $this->assertEquals(.6, $sentiment['magnitude']); + + $expectedOutput = <<expectOutputString($expectedOutput); + } +} diff --git a/logging/README.md b/logging/api/README.md similarity index 100% rename from logging/README.md rename to logging/api/README.md diff --git a/logging/composer.json b/logging/api/composer.json similarity index 100% rename from logging/composer.json rename to logging/api/composer.json diff --git a/logging/composer.lock b/logging/api/composer.lock similarity index 100% rename from logging/composer.lock rename to logging/api/composer.lock diff --git a/logging/logging.php b/logging/api/logging.php similarity index 100% rename from logging/logging.php rename to logging/api/logging.php diff --git a/logging/phpunit.xml.dist b/logging/api/phpunit.xml.dist similarity index 100% rename from logging/phpunit.xml.dist rename to logging/api/phpunit.xml.dist diff --git a/logging/src/BaseCommand.php b/logging/api/src/BaseCommand.php similarity index 100% rename from logging/src/BaseCommand.php rename to logging/api/src/BaseCommand.php diff --git a/logging/src/CreateSinkCommand.php b/logging/api/src/CreateSinkCommand.php similarity index 100% rename from logging/src/CreateSinkCommand.php rename to logging/api/src/CreateSinkCommand.php diff --git a/logging/src/DeleteLoggerCommand.php b/logging/api/src/DeleteLoggerCommand.php similarity index 100% rename from logging/src/DeleteLoggerCommand.php rename to logging/api/src/DeleteLoggerCommand.php diff --git a/logging/src/DeleteSinkCommand.php b/logging/api/src/DeleteSinkCommand.php similarity index 100% rename from logging/src/DeleteSinkCommand.php rename to logging/api/src/DeleteSinkCommand.php diff --git a/logging/src/ListEntriesCommand.php b/logging/api/src/ListEntriesCommand.php similarity index 100% rename from logging/src/ListEntriesCommand.php rename to logging/api/src/ListEntriesCommand.php diff --git a/logging/src/ListSinksCommand.php b/logging/api/src/ListSinksCommand.php similarity index 100% rename from logging/src/ListSinksCommand.php rename to logging/api/src/ListSinksCommand.php diff --git a/logging/src/UpdateSinkCommand.php b/logging/api/src/UpdateSinkCommand.php similarity index 100% rename from logging/src/UpdateSinkCommand.php rename to logging/api/src/UpdateSinkCommand.php diff --git a/logging/src/WriteCommand.php b/logging/api/src/WriteCommand.php similarity index 100% rename from logging/src/WriteCommand.php rename to logging/api/src/WriteCommand.php diff --git a/logging/src/functions/log_entry_functions.php b/logging/api/src/functions/log_entry_functions.php similarity index 100% rename from logging/src/functions/log_entry_functions.php rename to logging/api/src/functions/log_entry_functions.php diff --git a/logging/src/functions/sink_functions.php b/logging/api/src/functions/sink_functions.php similarity index 100% rename from logging/src/functions/sink_functions.php rename to logging/api/src/functions/sink_functions.php diff --git a/logging/test/CreateSinkCommandTest.php b/logging/api/test/CreateSinkCommandTest.php similarity index 100% rename from logging/test/CreateSinkCommandTest.php rename to logging/api/test/CreateSinkCommandTest.php diff --git a/logging/test/DeleteLoggerCommandTest.php b/logging/api/test/DeleteLoggerCommandTest.php similarity index 100% rename from logging/test/DeleteLoggerCommandTest.php rename to logging/api/test/DeleteLoggerCommandTest.php diff --git a/logging/test/DeleteSinkCommandTest.php b/logging/api/test/DeleteSinkCommandTest.php similarity index 100% rename from logging/test/DeleteSinkCommandTest.php rename to logging/api/test/DeleteSinkCommandTest.php diff --git a/logging/test/ListEntriesCommandTest.php b/logging/api/test/ListEntriesCommandTest.php similarity index 100% rename from logging/test/ListEntriesCommandTest.php rename to logging/api/test/ListEntriesCommandTest.php diff --git a/logging/test/ListSinksCommandTest.php b/logging/api/test/ListSinksCommandTest.php similarity index 100% rename from logging/test/ListSinksCommandTest.php rename to logging/api/test/ListSinksCommandTest.php diff --git a/logging/test/UpdateSinkCommandTest.php b/logging/api/test/UpdateSinkCommandTest.php similarity index 100% rename from logging/test/UpdateSinkCommandTest.php rename to logging/api/test/UpdateSinkCommandTest.php diff --git a/logging/test/WriteCommandTest.php b/logging/api/test/WriteCommandTest.php similarity index 100% rename from logging/test/WriteCommandTest.php rename to logging/api/test/WriteCommandTest.php diff --git a/logging/api/test/bootstrap.php b/logging/api/test/bootstrap.php new file mode 100644 index 0000000000..6c8c4f51b9 --- /dev/null +++ b/logging/api/test/bootstrap.php @@ -0,0 +1,3 @@ +=5.4", + "google/cloud": "0.10" + } +} diff --git a/logging/quickstart/composer.lock b/logging/quickstart/composer.lock new file mode 100644 index 0000000000..0b6d1c4b50 --- /dev/null +++ b/logging/quickstart/composer.lock @@ -0,0 +1,632 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "f75b529e9f42e9c698da7cbb22ae4f13", + "content-hash": "4c7836060be1fc699affa599c19eb06d", + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2015-07-22 18:31:08" + }, + { + "name": "google/auth", + "version": "v0.10", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/760e3fbe4064c0525c22e27e5374eada3c103da8", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0", + "guzzlehttp/guzzle": "~5.3|~6.0", + "guzzlehttp/psr7": "~1.2", + "php": ">=5.4", + "psr/cache": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ], + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2016-08-02 22:00:48" + }, + { + "name": "google/cloud", + "version": "v0.10.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/google-cloud-php.git", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/zipball/ad867d788e855b3423fb8866b15ea23fbe844cbe", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe", + "shasum": "" + }, + "require": { + "google/auth": "0.10", + "guzzlehttp/guzzle": "~5.2|~6.0", + "guzzlehttp/psr7": "^1.2", + "monolog/monolog": "~1", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "james-heinrich/getid3": "^1.9", + "league/json-guard": "^0.3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*", + "symfony/console": "^3.0", + "vierbergenlars/php-semver": "^3.0" + }, + "suggest": { + "google/gax": "Required to support gRPC", + "google/proto-client-php": "Required to support gRPC", + "james-heinrich/getid3": "Allows the Google Cloud Speech client to determine sample rate and encoding of audio inputs" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Cloud\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "John Pedrie", + "email": "john@pedrie.com" + }, + { + "name": "Dave Supplee", + "email": "dwsupplee@gmail.com" + } + ], + "description": "Google Cloud Client Library", + "homepage": "http://github.com/GoogleCloudPlatform/google-cloud-php", + "keywords": [ + "big query", + "bigquery", + "cloud", + "datastore", + "gcs", + "google", + "google api", + "google api client", + "google apis", + "google apis client", + "google cloud", + "google cloud platform", + "natural language", + "pub sub", + "pubsub", + "speech", + "stackdriver logging", + "storage", + "translate", + "vision" + ], + "time": "2016-10-05 15:18:51" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.3.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0", + "psr/log": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-07-15 17:22:37" + }, + { + "name": "guzzlehttp/promises", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-05-18 16:56:05" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2016-06-24 23:00:38" + }, + { + "name": "monolog/monolog", + "version": "1.21.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-07-29 03:23:52" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06 20:24:11" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-09-19 16:02:08" + }, + { + "name": "rize/uri-template", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2496aa674438f1c48fce122ffc44291ad7014717", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Rize\\UriTemplate": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "time": "2015-04-17 16:12:22" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [] +} diff --git a/logging/quickstart/phpunit.xml.dist b/logging/quickstart/phpunit.xml.dist new file mode 100644 index 0000000000..fd6299216c --- /dev/null +++ b/logging/quickstart/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + test + + + + + + + + quickstart.php + + + diff --git a/logging/quickstart/quickstart.php b/logging/quickstart/quickstart.php new file mode 100644 index 0000000000..cac421c4de --- /dev/null +++ b/logging/quickstart/quickstart.php @@ -0,0 +1,37 @@ + $projectId +]); + +# The name of the log to write to +$logName = 'my-log'; + +# Selects the log to write to +$logger = $logging->logger($logName); + +# The data to log +$text = 'Hello, world!'; + +# Creates the log entry +$entry = $logger->entry($text, [ + 'type' => 'global' +]); + +# Writes the log entry +$logger->write($entry); + +echo 'Logged ' . $text; +# [END logging_quickstart] +return $entry; diff --git a/logging/quickstart/test/bootstrap.php b/logging/quickstart/test/bootstrap.php new file mode 100644 index 0000000000..6c8c4f51b9 --- /dev/null +++ b/logging/quickstart/test/bootstrap.php @@ -0,0 +1,3 @@ +markTestSkipped('GOOGLE_PROJECT_ID must be set.'); + } + + $file = sys_get_temp_dir() . '/logging_quickstart.php'; + $contents = file_get_contents(__DIR__ . '/../quickstart.php'); + $contents = str_replace( + ['YOUR_PROJECT_ID', '__DIR__'], + [$projectId, sprintf('"%s/.."', __DIR__)], + $contents + ); + file_put_contents($file, $contents); + + // Invoke quickstart.php + $entry = include $file; + + // Make sure it looks correct + $this->assertInstanceOf('Google\Cloud\Logging\Entry', $entry); + $info = $entry->info(); + $this->assertEquals('Hello, world!', $info['textPayload']); + $this->assertContains('my-log', $info['logName']); + $this->assertEquals('global', $info['resource']['type']); + } +} diff --git a/pubsub/quickstart/composer.json b/pubsub/quickstart/composer.json new file mode 100644 index 0000000000..c41b6683f5 --- /dev/null +++ b/pubsub/quickstart/composer.json @@ -0,0 +1,6 @@ +{ + "require": { + "php": ">=5.4", + "google/cloud": "0.10" + } +} diff --git a/pubsub/quickstart/composer.lock b/pubsub/quickstart/composer.lock new file mode 100644 index 0000000000..0b6d1c4b50 --- /dev/null +++ b/pubsub/quickstart/composer.lock @@ -0,0 +1,632 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "f75b529e9f42e9c698da7cbb22ae4f13", + "content-hash": "4c7836060be1fc699affa599c19eb06d", + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2015-07-22 18:31:08" + }, + { + "name": "google/auth", + "version": "v0.10", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/760e3fbe4064c0525c22e27e5374eada3c103da8", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0", + "guzzlehttp/guzzle": "~5.3|~6.0", + "guzzlehttp/psr7": "~1.2", + "php": ">=5.4", + "psr/cache": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ], + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2016-08-02 22:00:48" + }, + { + "name": "google/cloud", + "version": "v0.10.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/google-cloud-php.git", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/zipball/ad867d788e855b3423fb8866b15ea23fbe844cbe", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe", + "shasum": "" + }, + "require": { + "google/auth": "0.10", + "guzzlehttp/guzzle": "~5.2|~6.0", + "guzzlehttp/psr7": "^1.2", + "monolog/monolog": "~1", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "james-heinrich/getid3": "^1.9", + "league/json-guard": "^0.3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*", + "symfony/console": "^3.0", + "vierbergenlars/php-semver": "^3.0" + }, + "suggest": { + "google/gax": "Required to support gRPC", + "google/proto-client-php": "Required to support gRPC", + "james-heinrich/getid3": "Allows the Google Cloud Speech client to determine sample rate and encoding of audio inputs" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Cloud\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "John Pedrie", + "email": "john@pedrie.com" + }, + { + "name": "Dave Supplee", + "email": "dwsupplee@gmail.com" + } + ], + "description": "Google Cloud Client Library", + "homepage": "http://github.com/GoogleCloudPlatform/google-cloud-php", + "keywords": [ + "big query", + "bigquery", + "cloud", + "datastore", + "gcs", + "google", + "google api", + "google api client", + "google apis", + "google apis client", + "google cloud", + "google cloud platform", + "natural language", + "pub sub", + "pubsub", + "speech", + "stackdriver logging", + "storage", + "translate", + "vision" + ], + "time": "2016-10-05 15:18:51" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.3.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0", + "psr/log": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-07-15 17:22:37" + }, + { + "name": "guzzlehttp/promises", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-05-18 16:56:05" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2016-06-24 23:00:38" + }, + { + "name": "monolog/monolog", + "version": "1.21.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-07-29 03:23:52" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06 20:24:11" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-09-19 16:02:08" + }, + { + "name": "rize/uri-template", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2496aa674438f1c48fce122ffc44291ad7014717", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Rize\\UriTemplate": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "time": "2015-04-17 16:12:22" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [] +} diff --git a/pubsub/quickstart/phpunit.xml.dist b/pubsub/quickstart/phpunit.xml.dist new file mode 100644 index 0000000000..6b7a8dde21 --- /dev/null +++ b/pubsub/quickstart/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + test + + + + + + + + quickstart.php + + + diff --git a/pubsub/quickstart/quickstart.php b/pubsub/quickstart/quickstart.php new file mode 100644 index 0000000000..bb7138dc6f --- /dev/null +++ b/pubsub/quickstart/quickstart.php @@ -0,0 +1,26 @@ + $projectId +]); + +# The name for the new topic +$topicName = 'my-new-topic'; + +# Creates the new topic +$topic = $pubsub->createTopic($topicName); + +echo 'Topic ' . $topic->name() . ' created.'; +# [END pubsub_quickstart] +return $topic; diff --git a/pubsub/quickstart/test/bootstrap.php b/pubsub/quickstart/test/bootstrap.php new file mode 100644 index 0000000000..6c8c4f51b9 --- /dev/null +++ b/pubsub/quickstart/test/bootstrap.php @@ -0,0 +1,3 @@ +markTestSkipped('GOOGLE_APPLICATION_CREDENTIALS must be set.'); + } + + $topicName = 'my-new-topic-' . time(); + $file = sys_get_temp_dir() . '/pubsub_quickstart.php'; + $contents = file_get_contents(__DIR__ . '/../quickstart.php'); + $contents = str_replace( + ['my-new-topic', 'YOUR_PROJECT_ID', '__DIR__'], + [$topicName, $projectId, sprintf('"%s/.."', __DIR__)], + $contents + ); + file_put_contents($file, $contents); + + // Invoke quickstart.php + $this->topic = include $file; + + // Make sure it looks correct + $this->assertInstanceOf('Google\Cloud\PubSub\Topic', $this->topic); + $this->assertContains($topicName, $this->topic->name()); + } + + public function tearDown() + { + if ($this->topic) { + $this->topic->delete(); + } + } +} diff --git a/speech/quickstart/composer.json b/speech/quickstart/composer.json new file mode 100644 index 0000000000..c41b6683f5 --- /dev/null +++ b/speech/quickstart/composer.json @@ -0,0 +1,6 @@ +{ + "require": { + "php": ">=5.4", + "google/cloud": "0.10" + } +} diff --git a/speech/quickstart/composer.lock b/speech/quickstart/composer.lock new file mode 100644 index 0000000000..0b6d1c4b50 --- /dev/null +++ b/speech/quickstart/composer.lock @@ -0,0 +1,632 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "f75b529e9f42e9c698da7cbb22ae4f13", + "content-hash": "4c7836060be1fc699affa599c19eb06d", + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2015-07-22 18:31:08" + }, + { + "name": "google/auth", + "version": "v0.10", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/760e3fbe4064c0525c22e27e5374eada3c103da8", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0", + "guzzlehttp/guzzle": "~5.3|~6.0", + "guzzlehttp/psr7": "~1.2", + "php": ">=5.4", + "psr/cache": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ], + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2016-08-02 22:00:48" + }, + { + "name": "google/cloud", + "version": "v0.10.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/google-cloud-php.git", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/zipball/ad867d788e855b3423fb8866b15ea23fbe844cbe", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe", + "shasum": "" + }, + "require": { + "google/auth": "0.10", + "guzzlehttp/guzzle": "~5.2|~6.0", + "guzzlehttp/psr7": "^1.2", + "monolog/monolog": "~1", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "james-heinrich/getid3": "^1.9", + "league/json-guard": "^0.3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*", + "symfony/console": "^3.0", + "vierbergenlars/php-semver": "^3.0" + }, + "suggest": { + "google/gax": "Required to support gRPC", + "google/proto-client-php": "Required to support gRPC", + "james-heinrich/getid3": "Allows the Google Cloud Speech client to determine sample rate and encoding of audio inputs" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Cloud\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "John Pedrie", + "email": "john@pedrie.com" + }, + { + "name": "Dave Supplee", + "email": "dwsupplee@gmail.com" + } + ], + "description": "Google Cloud Client Library", + "homepage": "http://github.com/GoogleCloudPlatform/google-cloud-php", + "keywords": [ + "big query", + "bigquery", + "cloud", + "datastore", + "gcs", + "google", + "google api", + "google api client", + "google apis", + "google apis client", + "google cloud", + "google cloud platform", + "natural language", + "pub sub", + "pubsub", + "speech", + "stackdriver logging", + "storage", + "translate", + "vision" + ], + "time": "2016-10-05 15:18:51" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.3.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0", + "psr/log": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-07-15 17:22:37" + }, + { + "name": "guzzlehttp/promises", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-05-18 16:56:05" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2016-06-24 23:00:38" + }, + { + "name": "monolog/monolog", + "version": "1.21.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-07-29 03:23:52" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06 20:24:11" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-09-19 16:02:08" + }, + { + "name": "rize/uri-template", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2496aa674438f1c48fce122ffc44291ad7014717", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Rize\\UriTemplate": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "time": "2015-04-17 16:12:22" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [] +} diff --git a/speech/quickstart/phpunit.xml.dist b/speech/quickstart/phpunit.xml.dist new file mode 100644 index 0000000000..f60f7eb980 --- /dev/null +++ b/speech/quickstart/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + test + + + + + + + + quickstart.php + + + diff --git a/speech/quickstart/quickstart.php b/speech/quickstart/quickstart.php new file mode 100644 index 0000000000..0f94585582 --- /dev/null +++ b/speech/quickstart/quickstart.php @@ -0,0 +1,32 @@ + $projectId +]); + +# The name of the audio file to transcribe +$fileName = __DIR__ . '/resources/audio.raw'; + +# The audio file's encoding and sample rate +$options = [ + 'encoding' => 'LINEAR16', + 'sampleRate' => 16000, +]; + +# Detects speech in the audio file +$results = $speech->recognize(fopen($fileName, 'r'), $options); + +echo 'Transcription: ' . $results[0]['transcript']; +# [END speech_quickstart] +return $results; diff --git a/speech/quickstart/resources/audio.raw b/speech/quickstart/resources/audio.raw new file mode 100644 index 0000000000..5ebf79d3c9 Binary files /dev/null and b/speech/quickstart/resources/audio.raw differ diff --git a/speech/quickstart/test/bootstrap.php b/speech/quickstart/test/bootstrap.php new file mode 100644 index 0000000000..6c8c4f51b9 --- /dev/null +++ b/speech/quickstart/test/bootstrap.php @@ -0,0 +1,3 @@ +markTestSkipped('GOOGLE_PROJECT_ID must be set.'); + } + + $file = sys_get_temp_dir() . '/speech_quickstart.php'; + $contents = file_get_contents(__DIR__ . '/../quickstart.php'); + $contents = str_replace( + ['YOUR_PROJECT_ID', '__DIR__'], + [$projectId, sprintf('"%s/.."', __DIR__)], + $contents + ); + file_put_contents($file, $contents); + + // Invoke quickstart.php + $results = include $file; + + // Make sure it looks correct + $this->assertTrue(is_array($results)); + $this->assertEquals(1, count($results)); + $this->assertArrayHasKey('transcript', $results[0]); + $this->assertArrayHasKey('confidence', $results[0]); + $this->assertEquals('how old is the Brooklyn Bridge', $results[0]['transcript']); + $this->assertTrue($results[0]['confidence'] > .9); + + $expectedOutput = <<expectOutputString($expectedOutput); + } +} diff --git a/storage/quickstart/composer.json b/storage/quickstart/composer.json new file mode 100644 index 0000000000..c41b6683f5 --- /dev/null +++ b/storage/quickstart/composer.json @@ -0,0 +1,6 @@ +{ + "require": { + "php": ">=5.4", + "google/cloud": "0.10" + } +} diff --git a/storage/quickstart/composer.lock b/storage/quickstart/composer.lock new file mode 100644 index 0000000000..a1206fa15c --- /dev/null +++ b/storage/quickstart/composer.lock @@ -0,0 +1,631 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "961be53cdb568c9c0c19f48f55b0fa66", + "content-hash": "52daf6d8a20f698e105309ea10a69031", + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2015-07-22 18:31:08" + }, + { + "name": "google/auth", + "version": "v0.10", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/760e3fbe4064c0525c22e27e5374eada3c103da8", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0", + "guzzlehttp/guzzle": "~5.3|~6.0", + "guzzlehttp/psr7": "~1.2", + "php": ">=5.4", + "psr/cache": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ], + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2016-08-02 22:00:48" + }, + { + "name": "google/cloud", + "version": "v0.9.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/google-cloud-php.git", + "reference": "a972770d8f36687dbb34f23df7d6d76027bf2323" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/zipball/a972770d8f36687dbb34f23df7d6d76027bf2323", + "reference": "a972770d8f36687dbb34f23df7d6d76027bf2323", + "shasum": "" + }, + "require": { + "google/auth": "0.10", + "guzzlehttp/guzzle": "~5.2|~6.0", + "guzzlehttp/psr7": "^1.2", + "monolog/monolog": "~1", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "james-heinrich/getid3": "^1.9", + "league/json-guard": "^0.3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*", + "symfony/console": "^3.0" + }, + "suggest": { + "google/gax": "Required to support gRPC", + "google/proto-client-php": "Required to support gRPC", + "james-heinrich/getid3": "Allows the Google Cloud Speech client to determine sample rate and encoding of audio inputs" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Cloud\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "John Pedrie", + "email": "john@pedrie.com" + }, + { + "name": "Dave Supplee", + "email": "dwsupplee@gmail.com" + } + ], + "description": "Google Cloud Client Library", + "homepage": "http://github.com/GoogleCloudPlatform/google-cloud-php", + "keywords": [ + "big query", + "bigquery", + "cloud", + "datastore", + "gcs", + "google", + "google api", + "google api client", + "google apis", + "google apis client", + "google cloud", + "google cloud platform", + "natural language", + "pub sub", + "pubsub", + "speech", + "stackdriver logging", + "storage", + "translate", + "vision" + ], + "time": "2016-09-26 15:59:01" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.3.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0", + "psr/log": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-07-15 17:22:37" + }, + { + "name": "guzzlehttp/promises", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-05-18 16:56:05" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2016-06-24 23:00:38" + }, + { + "name": "monolog/monolog", + "version": "1.21.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-07-29 03:23:52" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06 20:24:11" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-09-19 16:02:08" + }, + { + "name": "rize/uri-template", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2496aa674438f1c48fce122ffc44291ad7014717", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Rize\\UriTemplate": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "time": "2015-04-17 16:12:22" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [] +} diff --git a/storage/quickstart/phpunit.xml.dist b/storage/quickstart/phpunit.xml.dist new file mode 100644 index 0000000000..fa95ce2d8d --- /dev/null +++ b/storage/quickstart/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + test + + + + + + + + quickstart.php + + + diff --git a/storage/quickstart/quickstart.php b/storage/quickstart/quickstart.php new file mode 100644 index 0000000000..3b46ff0e50 --- /dev/null +++ b/storage/quickstart/quickstart.php @@ -0,0 +1,26 @@ + $projectId +]); + +# The name for the new bucket +$bucketName = 'my-new-bucket'; + +# Creates the new bucket +$bucket = $storage->createBucket($bucketName); + +echo 'Bucket ' . $bucket->name() . ' created.'; +# [END storage_quickstart] +return $bucket; diff --git a/storage/quickstart/test/bootstrap.php b/storage/quickstart/test/bootstrap.php new file mode 100644 index 0000000000..6c8c4f51b9 --- /dev/null +++ b/storage/quickstart/test/bootstrap.php @@ -0,0 +1,3 @@ +markTestSkipped('GOOGLE_PROJECT_ID must be set.'); + } + + $bucketName = 'my-new-bucket-' . time(); + $file = sys_get_temp_dir() . '/storage_quickstart.php'; + $contents = file_get_contents(__DIR__ . '/../quickstart.php'); + $contents = str_replace( + ['YOUR_PROJECT_ID', 'my-new-bucket', '__DIR__'], + [$projectId, $bucketName, sprintf('"%s/.."', __DIR__)], + $contents + ); + file_put_contents($file, $contents); + + // Invoke quickstart.php + $bucket = include $file; + + // Make sure it looks correct + $this->assertInstanceOf('Google\Cloud\Storage\Bucket', $bucket); + $this->assertEquals($bucketName, $bucket->name()); + $bucket->delete(); + } +} diff --git a/translate/quickstart/composer.json b/translate/quickstart/composer.json new file mode 100644 index 0000000000..c41b6683f5 --- /dev/null +++ b/translate/quickstart/composer.json @@ -0,0 +1,6 @@ +{ + "require": { + "php": ">=5.4", + "google/cloud": "0.10" + } +} diff --git a/translate/quickstart/composer.lock b/translate/quickstart/composer.lock new file mode 100644 index 0000000000..0b6d1c4b50 --- /dev/null +++ b/translate/quickstart/composer.lock @@ -0,0 +1,632 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "f75b529e9f42e9c698da7cbb22ae4f13", + "content-hash": "4c7836060be1fc699affa599c19eb06d", + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2015-07-22 18:31:08" + }, + { + "name": "google/auth", + "version": "v0.10", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/760e3fbe4064c0525c22e27e5374eada3c103da8", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0", + "guzzlehttp/guzzle": "~5.3|~6.0", + "guzzlehttp/psr7": "~1.2", + "php": ">=5.4", + "psr/cache": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ], + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2016-08-02 22:00:48" + }, + { + "name": "google/cloud", + "version": "v0.10.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/google-cloud-php.git", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/zipball/ad867d788e855b3423fb8866b15ea23fbe844cbe", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe", + "shasum": "" + }, + "require": { + "google/auth": "0.10", + "guzzlehttp/guzzle": "~5.2|~6.0", + "guzzlehttp/psr7": "^1.2", + "monolog/monolog": "~1", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "james-heinrich/getid3": "^1.9", + "league/json-guard": "^0.3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*", + "symfony/console": "^3.0", + "vierbergenlars/php-semver": "^3.0" + }, + "suggest": { + "google/gax": "Required to support gRPC", + "google/proto-client-php": "Required to support gRPC", + "james-heinrich/getid3": "Allows the Google Cloud Speech client to determine sample rate and encoding of audio inputs" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Cloud\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "John Pedrie", + "email": "john@pedrie.com" + }, + { + "name": "Dave Supplee", + "email": "dwsupplee@gmail.com" + } + ], + "description": "Google Cloud Client Library", + "homepage": "http://github.com/GoogleCloudPlatform/google-cloud-php", + "keywords": [ + "big query", + "bigquery", + "cloud", + "datastore", + "gcs", + "google", + "google api", + "google api client", + "google apis", + "google apis client", + "google cloud", + "google cloud platform", + "natural language", + "pub sub", + "pubsub", + "speech", + "stackdriver logging", + "storage", + "translate", + "vision" + ], + "time": "2016-10-05 15:18:51" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.3.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0", + "psr/log": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-07-15 17:22:37" + }, + { + "name": "guzzlehttp/promises", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-05-18 16:56:05" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2016-06-24 23:00:38" + }, + { + "name": "monolog/monolog", + "version": "1.21.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-07-29 03:23:52" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06 20:24:11" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-09-19 16:02:08" + }, + { + "name": "rize/uri-template", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2496aa674438f1c48fce122ffc44291ad7014717", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Rize\\UriTemplate": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "time": "2015-04-17 16:12:22" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [] +} diff --git a/translate/quickstart/phpunit.xml.dist b/translate/quickstart/phpunit.xml.dist new file mode 100644 index 0000000000..1b0c6343b5 --- /dev/null +++ b/translate/quickstart/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + test + + + + + + + + quickstart.php + + + diff --git a/translate/quickstart/quickstart.php b/translate/quickstart/quickstart.php new file mode 100644 index 0000000000..070a0fc0a5 --- /dev/null +++ b/translate/quickstart/quickstart.php @@ -0,0 +1,31 @@ + $apiKey +]); + +# The text to translate +$text = 'Hello, world!'; +# The target language +$target = 'ru'; + +# Translates some text into Russian +$translation = $translate->translate($text, [ + 'target' => $target +]); + +echo 'Text: ' . $text . ' +Translation: ' . $translation['text']; +# [END translate_quickstart] +return $translation; diff --git a/translate/quickstart/test/bootstrap.php b/translate/quickstart/test/bootstrap.php new file mode 100644 index 0000000000..6c8c4f51b9 --- /dev/null +++ b/translate/quickstart/test/bootstrap.php @@ -0,0 +1,3 @@ +markTestSkipped('GOOGLE_API_KEY must be set.'); + } + + $file = sys_get_temp_dir() . '/translate_quickstart.php'; + $contents = file_get_contents(__DIR__ . '/../quickstart.php'); + $contents = str_replace( + ['YOUR_API_KEY', '__DIR__'], + [$key, sprintf('"%s/.."', __DIR__)], + $contents + ); + file_put_contents($file, $contents); + + // Invoke quickstart.php + $translation = include $file; + + // Make sure it looks correct + $this->assertTrue(is_array($translation)); + $this->assertArrayHasKey('source', $translation); + $this->assertArrayHasKey('input', $translation); + $this->assertArrayHasKey('text', $translation); + $this->assertEquals('en', $translation['source']); + $this->assertEquals('Hello, world!', $translation['input']); + $this->assertEquals('Привет мир!', $translation['text']); + } +} diff --git a/vision/quickstart/composer.json b/vision/quickstart/composer.json new file mode 100644 index 0000000000..c41b6683f5 --- /dev/null +++ b/vision/quickstart/composer.json @@ -0,0 +1,6 @@ +{ + "require": { + "php": ">=5.4", + "google/cloud": "0.10" + } +} diff --git a/vision/quickstart/composer.lock b/vision/quickstart/composer.lock new file mode 100644 index 0000000000..0b6d1c4b50 --- /dev/null +++ b/vision/quickstart/composer.lock @@ -0,0 +1,632 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "This file is @generated automatically" + ], + "hash": "f75b529e9f42e9c698da7cbb22ae4f13", + "content-hash": "4c7836060be1fc699affa599c19eb06d", + "packages": [ + { + "name": "firebase/php-jwt", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/firebase/php-jwt.git", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "reference": "fa8a06e96526eb7c0eeaa47e4f39be59d21f16e1", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Firebase\\JWT\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Neuman Vong", + "email": "neuman+pear@twilio.com", + "role": "Developer" + }, + { + "name": "Anant Narayanan", + "email": "anant@php.net", + "role": "Developer" + } + ], + "description": "A simple library to encode and decode JSON Web Tokens (JWT) in PHP. Should conform to the current spec.", + "homepage": "https://github.com/firebase/php-jwt", + "time": "2015-07-22 18:31:08" + }, + { + "name": "google/auth", + "version": "v0.10", + "source": { + "type": "git", + "url": "https://github.com/google/google-auth-library-php.git", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/google/google-auth-library-php/zipball/760e3fbe4064c0525c22e27e5374eada3c103da8", + "reference": "760e3fbe4064c0525c22e27e5374eada3c103da8", + "shasum": "" + }, + "require": { + "firebase/php-jwt": "~2.0|~3.0", + "guzzlehttp/guzzle": "~5.3|~6.0", + "guzzlehttp/psr7": "~1.2", + "php": ">=5.4", + "psr/cache": "^1.0", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^1.11", + "phpunit/phpunit": "3.7.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ], + "psr-4": { + "Google\\Auth\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "description": "Google Auth Library for PHP", + "homepage": "http://github.com/google/google-auth-library-php", + "keywords": [ + "Authentication", + "google", + "oauth2" + ], + "time": "2016-08-02 22:00:48" + }, + { + "name": "google/cloud", + "version": "v0.10.0", + "source": { + "type": "git", + "url": "https://github.com/GoogleCloudPlatform/google-cloud-php.git", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/GoogleCloudPlatform/google-cloud-php/zipball/ad867d788e855b3423fb8866b15ea23fbe844cbe", + "reference": "ad867d788e855b3423fb8866b15ea23fbe844cbe", + "shasum": "" + }, + "require": { + "google/auth": "0.10", + "guzzlehttp/guzzle": "~5.2|~6.0", + "guzzlehttp/psr7": "^1.2", + "monolog/monolog": "~1", + "php": ">=5.5", + "psr/http-message": "1.0.*", + "rize/uri-template": "~0.3" + }, + "require-dev": { + "erusev/parsedown": "^1.6", + "james-heinrich/getid3": "^1.9", + "league/json-guard": "^0.3", + "phpdocumentor/reflection": "^3.0", + "phpunit/phpunit": "4.8.*", + "squizlabs/php_codesniffer": "2.*", + "symfony/console": "^3.0", + "vierbergenlars/php-semver": "^3.0" + }, + "suggest": { + "google/gax": "Required to support gRPC", + "google/proto-client-php": "Required to support gRPC", + "james-heinrich/getid3": "Allows the Google Cloud Speech client to determine sample rate and encoding of audio inputs" + }, + "type": "library", + "autoload": { + "psr-4": { + "Google\\Cloud\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "John Pedrie", + "email": "john@pedrie.com" + }, + { + "name": "Dave Supplee", + "email": "dwsupplee@gmail.com" + } + ], + "description": "Google Cloud Client Library", + "homepage": "http://github.com/GoogleCloudPlatform/google-cloud-php", + "keywords": [ + "big query", + "bigquery", + "cloud", + "datastore", + "gcs", + "google", + "google api", + "google api client", + "google apis", + "google apis client", + "google cloud", + "google cloud platform", + "natural language", + "pub sub", + "pubsub", + "speech", + "stackdriver logging", + "storage", + "translate", + "vision" + ], + "time": "2016-10-05 15:18:51" + }, + { + "name": "guzzlehttp/guzzle", + "version": "6.2.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/3f808fba627f2c5b69e2501217bf31af349c1427", + "reference": "3f808fba627f2c5b69e2501217bf31af349c1427", + "shasum": "" + }, + "require": { + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.3.1", + "php": ">=5.5" + }, + "require-dev": { + "ext-curl": "*", + "phpunit/phpunit": "^4.0", + "psr/log": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.2-dev" + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "time": "2016-07-15 17:22:37" + }, + { + "name": "guzzlehttp/promises", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/c10d860e2a9595f8883527fa0021c7da9e65f579", + "reference": "c10d860e2a9595f8883527fa0021c7da9e65f579", + "shasum": "" + }, + "require": { + "php": ">=5.5.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "time": "2016-05-18 16:56:05" + }, + { + "name": "guzzlehttp/psr7", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "reference": "5c6447c9df362e8f8093bda8f5d8873fe5c7f65b", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "psr/http-message": "~1.0" + }, + "provide": { + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4-dev" + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "PSR-7 message implementation", + "keywords": [ + "http", + "message", + "stream", + "uri" + ], + "time": "2016-06-24 23:00:38" + }, + { + "name": "monolog/monolog", + "version": "1.21.0", + "source": { + "type": "git", + "url": "https://github.com/Seldaek/monolog.git", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "reference": "f42fbdfd53e306bda545845e4dbfd3e72edb4952", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "psr/log": "~1.0" + }, + "provide": { + "psr/log-implementation": "1.0.0" + }, + "require-dev": { + "aws/aws-sdk-php": "^2.4.9", + "doctrine/couchdb": "~1.0@dev", + "graylog2/gelf-php": "~1.0", + "jakub-onderka/php-parallel-lint": "0.9", + "php-amqplib/php-amqplib": "~2.4", + "php-console/php-console": "^3.1.3", + "phpunit/phpunit": "~4.5", + "phpunit/phpunit-mock-objects": "2.3.0", + "ruflin/elastica": ">=0.90 <3.0", + "sentry/sentry": "^0.13", + "swiftmailer/swiftmailer": "~5.3" + }, + "suggest": { + "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", + "doctrine/couchdb": "Allow sending log messages to a CouchDB server", + "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)", + "ext-mongo": "Allow sending log messages to a MongoDB server", + "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server", + "mongodb/mongodb": "Allow sending log messages to a MongoDB server via PHP Driver", + "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib", + "php-console/php-console": "Allow sending log messages to Google Chrome", + "rollbar/rollbar": "Allow sending log messages to Rollbar", + "ruflin/elastica": "Allow sending log messages to an Elastic Search server", + "sentry/sentry": "Allow sending log messages to a Sentry server" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Monolog\\": "src/Monolog" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "Sends your logs to files, sockets, inboxes, databases and various web services", + "homepage": "http://github.com/Seldaek/monolog", + "keywords": [ + "log", + "logging", + "psr-3" + ], + "time": "2016-07-29 03:23:52" + }, + { + "name": "psr/cache", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/cache.git", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/cache/zipball/d11b50ad223250cf17b86e38383413f5a6764bf8", + "reference": "d11b50ad223250cf17b86e38383413f5a6764bf8", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for caching libraries", + "keywords": [ + "cache", + "psr", + "psr-6" + ], + "time": "2016-08-06 20:24:11" + }, + { + "name": "psr/http-message", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", + "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "time": "2016-08-06 14:39:51" + }, + { + "name": "psr/log", + "version": "1.0.1", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0", + "reference": "5277094ed527a1c4477177d102fe4c53551953e0", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-09-19 16:02:08" + }, + { + "name": "rize/uri-template", + "version": "0.3.0", + "source": { + "type": "git", + "url": "https://github.com/rize/UriTemplate.git", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/rize/UriTemplate/zipball/2496aa674438f1c48fce122ffc44291ad7014717", + "reference": "2496aa674438f1c48fce122ffc44291ad7014717", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0.0" + }, + "type": "library", + "autoload": { + "psr-0": { + "Rize\\UriTemplate": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Marut K", + "homepage": "http://twitter.com/rezigned" + } + ], + "description": "PHP URI Template (RFC 6570) supports both expansion & extraction", + "keywords": [ + "RFC 6570", + "template", + "uri" + ], + "time": "2015-04-17 16:12:22" + } + ], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.4" + }, + "platform-dev": [] +} diff --git a/vision/quickstart/phpunit.xml.dist b/vision/quickstart/phpunit.xml.dist new file mode 100644 index 0000000000..cbec789b35 --- /dev/null +++ b/vision/quickstart/phpunit.xml.dist @@ -0,0 +1,31 @@ + + + + + + test + + + + + + + + quickstart.php + + + diff --git a/vision/quickstart/quickstart.php b/vision/quickstart/quickstart.php new file mode 100644 index 0000000000..5a6918ab58 --- /dev/null +++ b/vision/quickstart/quickstart.php @@ -0,0 +1,34 @@ + $projectId +]); + +# The name of the image file to annotate +$fileName = __DIR__ . '/resources/wakeupcat.jpg'; + +# Prepare the image to be annotated +$image = $vision->image(fopen($fileName, 'r'), [ + 'LABEL_DETECTION' +]); + +# Performs label detection on the image file +$labels = $vision->annotate($image)->labels(); + +echo "Labels:\n"; +foreach ($labels as $label) { + echo $label->description() . "\n"; +} +# [END vision_quickstart] +return $labels; diff --git a/vision/quickstart/resources/wakeupcat.jpg b/vision/quickstart/resources/wakeupcat.jpg new file mode 100644 index 0000000000..139cf461ec Binary files /dev/null and b/vision/quickstart/resources/wakeupcat.jpg differ diff --git a/vision/quickstart/test/bootstrap.php b/vision/quickstart/test/bootstrap.php new file mode 100644 index 0000000000..6c8c4f51b9 --- /dev/null +++ b/vision/quickstart/test/bootstrap.php @@ -0,0 +1,3 @@ +markTestSkipped('GOOGLE_PROJECT_ID must be set.'); + } + + $file = sys_get_temp_dir() . '/vision_quickstart.php'; + $contents = file_get_contents(__DIR__ . '/../quickstart.php'); + $contents = str_replace( + ['YOUR_PROJECT_ID', '__DIR__'], + [$projectId, sprintf('"%s/.."', __DIR__)], + $contents + ); + file_put_contents($file, $contents); + + // Invoke quickstart.php + $labels = include $file; + + // Make sure it looks correct + $this->assertTrue(is_array($labels)); + $this->assertEquals(5, count($labels)); + + $expectedOutput = <<expectOutputString($expectedOutput); + } +}