From e0ac6748927f6e47fbac2959d2f4ce1783d706fd Mon Sep 17 00:00:00 2001 From: Google Code Exporter Date: Thu, 21 Apr 2016 03:46:17 -0400 Subject: [PATCH] Migrating wiki contents from Google Code --- AdvancedConfiguration.md | 55 +++++++++++++++++++++++++ BecomingAContributor.md | 27 +++++++++++++ FAQ.md | 25 ++++++++++++ GettingStarted.md | 86 ++++++++++++++++++++++++++++++++++++++++ OAuth2.md | 3 ++ ProjectHome.md | 1 + Samples.md | 5 +++ TableOfContents.md | 10 +++++ UsingTheLibrary.md | 6 +++ 9 files changed, 218 insertions(+) create mode 100644 AdvancedConfiguration.md create mode 100644 BecomingAContributor.md create mode 100644 FAQ.md create mode 100644 GettingStarted.md create mode 100644 OAuth2.md create mode 100644 ProjectHome.md create mode 100644 Samples.md create mode 100644 TableOfContents.md create mode 100644 UsingTheLibrary.md diff --git a/AdvancedConfiguration.md b/AdvancedConfiguration.md new file mode 100644 index 0000000..dfd35d5 --- /dev/null +++ b/AdvancedConfiguration.md @@ -0,0 +1,55 @@ +**Development on the Google PHP client library moved to `GitHub` with the release of the 1.0.0-alpha, and now the 1.0 branch has reached beta status there will be no further releases of the 0.6 branch of the library.** + +Please take a look at the latest version on https://github.com/google/google-api-php-client + +For information on migrating, please take a look at this guide: https://developers.google.com/api-client-library/php/guide/migration + +# Introduction # + +The library has been pre-configured to 'just work' when you download it, however in larger production environments it can be important to use different http transport, cache or authentication methods- and the library was build with this in mind. + +You can swap out what classes the library uses for it's cache, http fetcher and authentication by editing the configuration file, and changing the class name to use. These classes should inherit the abstract base class. + +You can find these in the `config.php` file: +``` + 'authClass' => 'apiOAuth' + 'ioClass' => 'apiCurlIO' + 'cacheClass' => 'apiFileCache' +``` + +The interface for the Authentication class looks like: +``` +abstract class apiAuth { + abstract public function authenticate(apiCache $cache, apiIO $io, $service); + abstract public function setAccessToken($accessToken); + abstract public function setDeveloperKey($developerKey); + abstract public function sign(apiHttpRequest $request); +} +``` + +The IO class is: +``` +interface apiIO { + public function __construct(apiCache $storage, apiAuth $auth); + public function authenticatedRequest(apiHttpRequest $request); + public function makeRequest(apiHttpRequest $request); + +} +``` + +And finally the abstract cache class: +``` +abstract class apiCache { + abstract function get($key, $expiration = false); + abstract function set($key, $value); + abstract function delete($key); +} +``` + +You can see an example how to implement a different methodigy for one of these classes is the [memcache cache class](http://code.google.com/p/google-api-php-client/source/browse/trunk/src/cache/apiMemcacheCache.php) implementation and the [APC cache class](http://code.google.com/p/google-api-php-client/source/browse/trunk/src/cache/apiApcCache.php) implementation. + +To make the library use one of these alternative implementation is as simple as changing the configuration value in your `config.php` file: + +``` + 'cacheClass' => 'apiMemcacheCache' +``` \ No newline at end of file diff --git a/BecomingAContributor.md b/BecomingAContributor.md new file mode 100644 index 0000000..10086a8 --- /dev/null +++ b/BecomingAContributor.md @@ -0,0 +1,27 @@ +**Development on the Google PHP client library moved to `GitHub` with the release of the 1.0.0-alpha, and now the 1.0 branch has reached beta status there will be no further releases of the 0.6 branch of the library.** + +Please take a look at the latest version on https://github.com/google/google-api-php-client + +For information on migrating, please take a look at this guide: https://developers.google.com/api-client-library/php/guide/migration + +# How to become a contributor and submit patches # + +## Contributor License Agreements ## + +We'd love to accept your code patches! However, before we can take them, we have to jump a couple of legal hurdles. + +Please fill out either the individual or corporate Contributor License Agreement. + + * If you are an individual writing original source code and you're sure you own the intellectual property, then you'll need to sign an [individual CLA](http://code.google.com/legal/individual-cla-v1.0.html). + * If you work for a company that wants to allow you to contribute your work to this client library, then you'll need to sign a [corporate CLA](http://code.google.com/legal/corporate-cla-v1.0.html). + +Follow either of the two links above to access the appropriate CLA and instructions for how to sign and return it. Once we receive it, we'll add you to the official list of contributors and be able to accept your patches. + +## Submitting Patches ## + + 1. Join [our discussion group](https://groups.google.com/forum/#!forum/google-api-php-client) (seriously, we want to talk to you!) + 1. Decide which code you want to submit. A submission should be a set of changes that addresses one issue in the [issue tracker](http://code.google.com/p/google-api-php-client/issues/list). Please file one change per issue, and address one issue per change. If you want to make a change that doesn't have a corresponding issue in the issue tracker, please file a new ticket! + 1. Ensure that your code adheres to [standard PHP conventions](http://framework.zend.com/manual/en/coding-standard.html). + 1. Ensure that there are unit tests for your code. + 1. Sign a Contributor License Agreement (see above). + 1. Attach the code (including unit tests) to the issue it addresses. For brand new files, attach the whole file. For patches to existing files, attach a Subversion diff (that is, svn diff from the project root). If you want to be really cool, [request a code review of your patch](http://codereview.appspot.com/) on the mailing list. \ No newline at end of file diff --git a/FAQ.md b/FAQ.md new file mode 100644 index 0000000..b6895d8 --- /dev/null +++ b/FAQ.md @@ -0,0 +1,25 @@ +Sections: + + +## SSL certificate problem, verify that the CA cert is OK ## + +**Problem**: I keep getting the error +``` +SSL certificate problem, verify that the CA cert is OK. +Details: SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed +``` + +**Solution**: +That means your server is unable to perform peer SSL certificate verification. + +Since the Windows version of PHP and it doesn't come bundled with a Certificate Authority bundle, you need to add it yourself. + +You need to add the following line to google-api-php-client/src/io/apiCurlIO.php right before "$data = @curl\_exec($ch);" +``` +curl_setopt($ch, CURLOPT_CAINFO, 'c:/path/to/ca-bundle.crt'); +``` + +You'll need to replace 'c:/path/to/ca-bundle.crt' to where ever you have the ca-bundle.crt file. + +See this thread for more information: +https://groups.google.com/d/msg/google-api-php-client/S1GBH6-2KOg/92zG1mlSFIIJ \ No newline at end of file diff --git a/GettingStarted.md b/GettingStarted.md new file mode 100644 index 0000000..d110cd3 --- /dev/null +++ b/GettingStarted.md @@ -0,0 +1,86 @@ +**Development on the Google PHP client library moved to `GitHub` with the release of the 1.0.0-alpha, and now the 1.0 branch has reached beta status there will be no further releases of the 0.6 branch of the library.** + +Please take a look at the latest version on https://github.com/google/google-api-php-client + +For information on migrating, please take a look at this guide: https://developers.google.com/api-client-library/php/guide/migration + +This client library helps you work with Google Plus data from your web server. This document will help explain where you can obtain the files for the client library, and how to use them in your own projects. + + + +# Requirements # + + * [PHP 5.3.x or higher](http://php.net/) + * PHP Curl extension + +# Obtaining the client library # + +There are two options for obtaining the files for the client library. + +## Obtaining the pre-packaged release ## +Most developers will want to use the pre-packaged release, as it will be the most stable version of the library. + +To download the library, go to the [Downloads tab](http://code.google.com/p/google-api-php-client/downloads/list). The most recent release of the library will be listed. + +After extracting the library from the archive, you will have a new `google-api-php-client-x.y` directory. The library files themselves are in the `google-api-php-client/src` directory. + +## Obtaining the most up-to-date version from SVN ## +The most up-to-date version of the code is available from this project's SVN repository. Obtaining the code this way is intended for developers looking for fixes or features that have not been released in the pre-packaged version, or for developers who want to contribute patches back to the project. + +Obtain the code by using the following SVN checkout command (you will need an SVN client installed on your computer): +``` + svn checkout http://google-api-php-client.googlecode.com/svn/trunk/ google-api-php-client +``` + +After checking out the code, you will have a new `google-api-php-client` directory. The library files themselves are in the `google-api-php-client/src` directory. + +# What to do with the files # + +After obtaining the library in either of the ways described above, you will have a directory named `google-api-php-client` somewhere on your filesystem, containing the library files. Specifically, you will need to include the file `src/Google_Client.php` and `src/contrib/Google_PlusService.php` inside of your scripts. + +To be able to include these files inside of your PHP scripts, you will need to tell PHP where it can find the client library. Listed below are some suggested ways of doing this. + +## Copy the `google-api-php-client` directory into your project ## + +If your project structure looks like this: +``` + myproject/ + |- myproject.php +``` + +Copy the `google-api-php-client` directory into the `myproject` directory. You can add the following code to `myproject.php` to include the client library: +``` + require_once "google-api-php-client/src/Google_Client.php"; + require_once "google-api-php-client/src/contrib/Google_PlusService.php"; +``` + +## Setting `include_path` by editing `php.ini` ## + +If you don't want to make a copy of the library directory for each of your projects, you can edit the `php.ini` PHP configuration file on your server and tell PHP where to find the client library. + +The line that configures `include_path` will contain some existing paths on your system: +``` + include_path=".:/usr/local/share/pear:/usr/local/PEAR" +``` + +Add a colon, followed by the path to your `google-api-php-client` directory: +``` + include_path=".:/usr/local/share/pear:/usr/local/PEAR:/path/to/google-api-php-client/src" +``` + +Once you restart your web server, you can include the library by using the following line in your PHP scripts: +``` + require_once "Google_Client.php"; + require_once "contrib/Google_PlusService.php +``` + +## Setting `include_path` dynamically inside of your code ## + +If you are unable to edit your `php.ini` file, you can still adjust the value of `include_path` inside of your PHP scripts. Just include the following code: +``` + set_include_path(get_include_path() . PATH_SEPARATOR . '/path/to/google-api-php-client/src'); + require_once "/Google_Client.php"; + require_once "/contrib/Google_PlusService.php"; +``` + +Next read about [using the library](UsingTheLibrary.md) \ No newline at end of file diff --git a/OAuth2.md b/OAuth2.md new file mode 100644 index 0000000..617bd08 --- /dev/null +++ b/OAuth2.md @@ -0,0 +1,3 @@ +**Development on the Google PHP client library moved to `GitHub` with the release of the 1.0.0-alpha, and now the 1.0 branch has reached beta status there will be no further releases of the 0.6 branch of the library.** + +Please take a look at the latest version on https://github.com/google/google-api-php-client \ No newline at end of file diff --git a/ProjectHome.md b/ProjectHome.md new file mode 100644 index 0000000..e7883ad --- /dev/null +++ b/ProjectHome.md @@ -0,0 +1 @@ +# This repository is deprecated, please see the latest on [GitHub](https://github.com/google/google-api-php-client) # \ No newline at end of file diff --git a/Samples.md b/Samples.md new file mode 100644 index 0000000..4ba9f34 --- /dev/null +++ b/Samples.md @@ -0,0 +1,5 @@ +**Development on the Google PHP client library moved to `GitHub` with the release of the 1.0.0-alpha, and now the 1.0 branch has reached beta status there will be no further releases of the 0.6 branch of the library.** + +Please take a look at the latest version on https://github.com/google/google-api-php-client + +For information on migrating, please take a look at this guide: https://developers.google.com/api-client-library/php/guide/migration \ No newline at end of file diff --git a/TableOfContents.md b/TableOfContents.md new file mode 100644 index 0000000..b8dfece --- /dev/null +++ b/TableOfContents.md @@ -0,0 +1,10 @@ +## Documentation ## + * [Getting Started](GettingStarted.md) + * [Using the library](UsingTheLibrary.md) + * [OAuth 2.0 support](OAuth2.md) + * [Included examples](Samples.md) + * [Advanced configuration & customization](AdvancedConfiguration.md) + * [Contributing](BecomingAContributor.md) + +If you'd like to see more examples or want more information about how to use the library, please file a feature request in [our issue tracker](http://code.google.com/p/google-api-php-client/issues/list) explaining what you'd like to see. + diff --git a/UsingTheLibrary.md b/UsingTheLibrary.md new file mode 100644 index 0000000..4545620 --- /dev/null +++ b/UsingTheLibrary.md @@ -0,0 +1,6 @@ +**Development on the Google PHP client library moved to `GitHub` with the release of the 1.0.0-alpha, and now the 1.0 branch has reached beta status there will be no further releases of the 0.6 branch of the library.** + +Please take a look at the latest version on https://github.com/google/google-api-php-client + +For information on migrating, please take a look at this guide: https://developers.google.com/api-client-library/php/guide/migration +Now that you've got a copy of the library, and included the files in your script, you're ready to start using it! \ No newline at end of file