Skip to content

Commit ec32df1

Browse files
committed
DX, organization, and auth cleanup
1 parent 0622efd commit ec32df1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3969
-1629
lines changed

.gitignore

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
.DS_Store
22
phpunit.xml
3-
composer.lock
43
vendor
54
examples/testfile-small.txt
65
examples/testfile.txt
7-
tests/.accessToken
86
tests/.apiKey

README.md

+31-26
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Build Status](https://travis-ci.org/google/google-api-php-client.svg)](https://travis-ci.org/google/google-api-php-client)
1+
[![Build Status](https://travis-ci.org/google/google-api-php-client.svg)](https://travis-ci.org/google/google-api-php-client.svg?branch=master)
22

33
# Google APIs Client Library for PHP #
44

@@ -9,10 +9,7 @@ The Google API Client Library enables you to work with Google APIs such as Googl
99
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.
1010

1111
## Requirements ##
12-
* [PHP 5.2.1 or higher](http://www.php.net/)
13-
* [PHP JSON extension](http://php.net/manual/en/book.json.php)
14-
15-
*Note*: some features (service accounts and id token verification) require PHP 5.3.0 and above due to cryptographic algorithm requirements.
12+
* [PHP 5.4.0 or higher](http://www.php.net/)
1613

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

2421
## Basic Example ##
25-
See the examples/ directory for examples of the key client features.
22+
See the examples/ directory for examples of the key client features. You can
23+
view them in your browser by running the php built-in web server.
24+
25+
```
26+
$ cd examples/
27+
$ php -S localhost:8000
28+
```
29+
30+
And then browsing to the host and port you specified
31+
(in the above example, `http://localhost:8000`).
32+
2633
```PHP
27-
<?php
28-
29-
require_once 'google-api-php-client/src/Google/autoload.php'; // or wherever autoload.php is located
30-
31-
$client = new Google_Client();
32-
$client->setApplicationName("Client_Library_Examples");
33-
$client->setDeveloperKey("YOUR_APP_KEY");
34-
35-
$service = new Google_Service_Books($client);
36-
$optParams = array('filter' => 'free-ebooks');
37-
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
38-
39-
foreach ($results as $item) {
40-
echo $item['volumeInfo']['title'], "<br /> \n";
41-
}
42-
34+
// include your composer dependencies
35+
require_once 'vendor/autoload.php';
36+
37+
$client = new Google_Client();
38+
$client->setApplicationName("Client_Library_Examples");
39+
$client->setDeveloperKey("YOUR_APP_KEY");
40+
41+
$service = new Google_Service_Books($client);
42+
$optParams = array('filter' => 'free-ebooks');
43+
$results = $service->volumes->listVolumes('Henry David Thoreau', $optParams);
44+
45+
foreach ($results as $item) {
46+
echo $item['volumeInfo']['title'], "<br /> \n";
47+
}
4348
```
4449

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

5964
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
6065

61-
### I want an example of X! ###
66+
### I want an example of X! ###
6267

6368
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!
6469

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

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

71-
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.
76+
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.
7277

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

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

97102
```
98-
vendor/bin/phpcs src --standard=style/ruleset.xml -np
103+
vendor/bin/phpcs src --standard=style/ruleset.xml -np
99104
```
100105

101-
To automatically fix (fixable) coding style violations, run
106+
To automatically fix (fixable) coding style violations, run
102107

103108
```
104109
vendor/bin/phpcbf src --standard=style/ruleset.xml

composer.json

+12-5
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,23 @@
77
"license": "Apache-2.0",
88
"require": {
99
"php": ">=5.4",
10-
"google/auth": "dev-master",
11-
"monolog/monolog": "^1.17"
10+
"google/auth": "v0.2-alpha",
11+
"monolog/monolog": "^1.17",
12+
"phpseclib/phpseclib": "~2.0",
13+
"guzzlehttp/guzzle": "5.2.*"
1214
},
1315
"require-dev": {
14-
"phpunit/phpunit": "3.7.*",
15-
"squizlabs/php_codesniffer": "~2.3"
16+
"phpunit/phpunit": "~4",
17+
"squizlabs/php_codesniffer": "~2.3",
18+
"symfony/dom-crawler": "~2.0",
19+
"symfony/css-selector": "~2.0"
1620
},
1721
"autoload": {
22+
"psr-0": {
23+
"Google_": "src/"
24+
},
1825
"classmap": [
19-
"src/"
26+
"src/Google/Service/"
2027
]
2128
},
2229
"extra": {

0 commit comments

Comments
 (0)