Thursday, September 08, 2011

Google APIs Client Library for PHP (Beta)


By Chirag Shah, Developer Programs Engineer

Today we are announcing a major milestone for another one of the Google APIs client libraries. The Google APIs Client Library for PHP has officially reached Beta.

This means we're comfortable enough with the stability and features of the library that we'd like you to start building real production applications on top of it and send us your feedback. The library now includes service-specific libraries and samples for several Google APIs, built on our new client library generation infrastructure.

The Google API PHP client supports the following Google APIs right now, with more on the way.
To grab the latest version of the library, simply run the following commands:
curl "http://google-api-php-client.googlecode.com/files/google-api-php-client-0.4.1.tar.gz" -O
tar -xvf  google-api-php-client-0.4.1.tar.gz
cd google-api-php-client/examples/
Here is some sample code that demonstrates how to use the library and the Google Books API to search for and print the titles of free ebooks by Henry David Thoreau:
<?php
require_once 'path/to/src/apiClient.php';
require_once 'path/to/src/contrib/apiBooksService.php';

$client = new apiClient();
$client->setApplicationName("My_Books_API_Example");
$service = new apiBooksService($client);

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

foreach ($results['items'] as $item) {
  print($item['volumeInfo']['title'] . '<br>');
}
Let us know what you think. We would love to hear your feedback and are always happy to help you out on the forums.

Since Google I/O 2010, we've been developing APIs that can provide descriptions of themselves via metadata. This new technique makes it easier to create and maintain client libraries that support more languages, work with more APIs, and are easier to use than ever before. This post announces one of several recent major milestones for our client libraries.


Chirag Shah is a Developer Programs Engineer on the Google+ team.
In his spare time, he enjoys listening to music and contributing to open source projects.


Posted by Scott Knaster, Editor


10 comments:

  1. I need to use the adwords and analytics api, is there any library out there?

    ReplyDelete
  2. Mr B.

    Yes, Google has an official API for Adwords, and there is a good unofficial one for Analytics.

    Next time, google it.

    ReplyDelete
  3. when you get calendar, doc, spreadsheets working then I'll look at it.. not before

    ReplyDelete
  4. CLIENTS MATTER, OBVIOUSLY.

    ReplyDelete
  5. oh cool, so pretty easy to make client API libraries. I'm sure we'll see Perl API libraries real soon now.

    ReplyDelete
  6. nice nice :D
    go go google \m/

    ReplyDelete
  7. Mirror Kitty - nope still now Perl Google+ you'd think the python people in google had some sort of chip on their shoulder wouldn't you.

    ReplyDelete
  8. Yeah, pretty sad that Google won't support any Perl libraries. Give us something guys!

    ReplyDelete
  9. I want people search in Google Plus. i know that is there is user search available in Java Language , is there way to get people information using Google plus api. ??

    ReplyDelete