Skip to content

Commit

Permalink
DX, organization, and auth cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bshaffer committed Oct 19, 2015
1 parent 0622efd commit ec32df1
Show file tree
Hide file tree
Showing 57 changed files with 3,969 additions and 1,629 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
.DS_Store
phpunit.xml
composer.lock
vendor
examples/testfile-small.txt
examples/testfile.txt
tests/.accessToken
tests/.apiKey
57 changes: 31 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![Build Status](https://travis-ci.org/google/google-api-php-client.svg)](https://travis-ci.org/google/google-api-php-client)
[![Build Status](https://travis-ci.org/google/google-api-php-client.svg)](https://travis-ci.org/google/google-api-php-client.svg?branch=master)

# Google APIs Client Library for PHP #

Expand All @@ -9,10 +9,7 @@ The Google API Client Library enables you to work with Google APIs such as Googl
This library is in Beta. We're comfortable enough with the stability and features of the library that we want you to build real production applications on it. We will make an effort to support the public and protected surface of the library and maintain backwards compatibility in the future. While we are still in Beta, we reserve the right to make incompatible changes. If we do remove some functionality (typically because better functionality exists or if the feature proved infeasible), our intention is to deprecate and provide ample time for developers to update their code.

## Requirements ##
* [PHP 5.2.1 or higher](http://www.php.net/)
* [PHP JSON extension](http://php.net/manual/en/book.json.php)

*Note*: some features (service accounts and id token verification) require PHP 5.3.0 and above due to cryptographic algorithm requirements.
* [PHP 5.4.0 or higher](http://www.php.net/)

## Developer Documentation ##
http://developers.google.com/api-client-library/php
Expand All @@ -22,24 +19,32 @@ http://developers.google.com/api-client-library/php
For the latest installation and setup instructions, see [the documentation](https://developers.google.com/api-client-library/php/start/installation).

## Basic Example ##
See the examples/ directory for examples of the key client features.
See the examples/ directory for examples of the key client features. You can
view them in your browser by running the php built-in web server.

```
$ cd examples/
$ php -S localhost:8000
```

And then browsing to the host and port you specified
(in the above example, `http://localhost:8000`).

```PHP
<?php

require_once 'google-api-php-client/src/Google/autoload.php'; // or wherever autoload.php is located

$client = new Google_Client();
$client->setApplicationName("Client_Library_Examples");
$client->setDeveloperKey("YOUR_APP_KEY");

$service = new Google_Service_Books($client);
$optParams = array('filter' => 'free-ebooks');
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);

foreach ($results as $item) {
echo $item['volumeInfo']['title'], "<br /> \n";
}

// include your composer dependencies
require_once 'vendor/autoload.php';

$client = new Google_Client();
$client->setApplicationName("Client_Library_Examples");
$client->setDeveloperKey("YOUR_APP_KEY");

$service = new Google_Service_Books($client);
$optParams = array('filter' => 'free-ebooks');
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);

foreach ($results as $item) {
echo $item['volumeInfo']['title'], "<br /> \n";
}
```

### Service Specific Examples ###
Expand All @@ -58,7 +63,7 @@ If there is a specific bug with the library, please file a issue in the Github i

We accept contributions via Github Pull Requests, but all contributors need to be covered by the standard Google Contributor License Agreement. You can find links, and more instructions, in the documentation: https://developers.google.com/api-client-library/php/contribute

### I want an example of X! ###
### I want an example of X! ###

If X is a feature of the library, file away! If X is an example of using a specific service, the best place to go is to the teams for those specific APIs - our preference is to link to their examples rather than add them to the library, as they can then pin to specific versions of the library. If you have any examples for other APIs, let us know and we will happily add a link to the README above!

Expand All @@ -68,7 +73,7 @@ When we started working on the 1.0.0 branch we knew there were several fundament

### Why does Google_..._Service have weird names? ###

The _Service classes are generally automatically generated from the API discovery documents: https://developers.google.com/discovery/. Sometimes new features are added to APIs with unusual names, which can cause some unexpected or non-standard style naming in the PHP classes.
The _Service classes are generally automatically generated from the API discovery documents: https://developers.google.com/discovery/. Sometimes new features are added to APIs with unusual names, which can cause some unexpected or non-standard style naming in the PHP classes.

### How do I deal with non-JSON response types? ###

Expand All @@ -95,10 +100,10 @@ Run the PHPUnit tests with PHPUnit. You can configure an API key and token in Ba
To check for coding style violations, run

```
vendor/bin/phpcs src --standard=style/ruleset.xml -np
vendor/bin/phpcs src --standard=style/ruleset.xml -np
```

To automatically fix (fixable) coding style violations, run
To automatically fix (fixable) coding style violations, run

```
vendor/bin/phpcbf src --standard=style/ruleset.xml
Expand Down
17 changes: 12 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,23 @@
"license": "Apache-2.0",
"require": {
"php": ">=5.4",
"google/auth": "dev-master",
"monolog/monolog": "^1.17"
"google/auth": "v0.2-alpha",
"monolog/monolog": "^1.17",
"phpseclib/phpseclib": "~2.0",
"guzzlehttp/guzzle": "5.2.*"
},
"require-dev": {
"phpunit/phpunit": "3.7.*",
"squizlabs/php_codesniffer": "~2.3"
"phpunit/phpunit": "~4",
"squizlabs/php_codesniffer": "~2.3",
"symfony/dom-crawler": "~2.0",
"symfony/css-selector": "~2.0"
},
"autoload": {
"psr-0": {
"Google_": "src/"
},
"classmap": [
"src/"
"src/Google/Service/"
]
},
"extra": {
Expand Down
Loading

0 comments on commit ec32df1

Please sign in to comment.