Google Api Client Codeigniter Spark

A carbon copy of the Google distributed PHP API Client, made available to the Sparks repository with some integration tips
Alternatives To Google Api Client Codeigniter Spark
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Spark Bigquery149
4 years ago6November 29, 201734apache-2.0Scala
Google BigQuery support for Spark, SQL, and DataFrames
Bdutil114
4 years ago32apache-2.0Shell
[DEPRECATED] Script used to manage Hadoop and Spark instances on Google Compute Engine
Laravel Spark Google2fa82
4 years ago15December 14, 20191mitPHP
Google Authenticator support for Laravel Spark
Token Dispenser56
4 years ago9gpl-2.0Java
Stores email-password pairs, gives out Google Play Store tokens
Spark Google Spreadsheets46
4 years ago10August 21, 20197apache-2.0Scala
Google Spreadsheets datasource for SparkSQL and DataFrames
Spark_gce45
8 years ago1apache-2.0Python
Spark GCE Script Helps you deploy Spark cluster on Google Cloud.
Google Api Client Codeigniter Spark36
11 years ago1apache-2.0PHP
A carbon copy of the Google distributed PHP API Client, made available to the Sparks repository with some integration tips
Spark Google Analytics33
6 years ago8June 21, 20175apache-2.0Scala
A Spark package for retrieving data from Google Analytics
Spree_analytics_trackers19
22 months ago7February 16, 20219bsd-3-clauseRuby
Integrate your Spree application with Google Analytics and Segment.com
Spark Streaming With Google Cloud Example19
7 years agoapache-2.0Scala
an example of integrating Spark Streaming with Google Pub/Sub and Google Datastore
Alternatives To Google Api Client Codeigniter Spark
Select To Compare


Alternative Project Comparisons
Readme

Google API Client

The summary description of this spark is simple: this is simply version 0.6.0 of the Google distributed PHP API Client (which supports Google's API version 3), without a single code change made to it, made available to the Sparks repository.

The Google API Client is used to interact with a plethora of Google web services:

  • AdSense
  • Affiliate Network
  • Analytics
  • Apps
  • Books
  • Calendar
  • Contacts
  • Latitude
  • Page Speed
  • Plus
  • Shopping
  • Tasks
  • Translate
  • URL Shortener
  • User Info
  • Web Fonts

All of the included documentation is included within this Spark directory (including Google's README file, included at the bottom of this document, LICENSE, NOTICE, examples, etc.)

Why Didn't You Port Anything To Codeigniter-ese?

Google has done a great job making their API easy to use, and they have provided a number of examples that users can simply copy and paste into their code. Since this is such a convenience for novice users or users unfamiliar with the Google API, this capability remains, so copy and paste away?

What Changes Are There With This Spark Compared to The Google Distributed Code?

None, but for your convenience we have included some example code which makes referencing the libraries included in this repository by name a little easier. Instead of doing:

<?php
require_once '../../src/apiClient.php';
?>

since conceptualizing these paths might be a little tricky within CodeIgniter, you can do:

<?php
require_once SPARKPATH . "GoogleAPIClient/0.6.0/src/apiClient.php";
?>

How Do I Load This Spark?

Normally this would be:

<?php
$this->load->spark('GoogleAPIClient/0.6.0');
?>

but this doesn't actually do anything since there are no CodeIgniter-esque config files, helpers, or libraries within this Spark. Just follow the example code (some included below) to init this Spark.

One note though, because you'll probably want to speak to Google within a CodeIgniter controller, you'll need to make available the variables defined in the included configuration file (see below) in your controller, which you can do as such (include this line before you start speaking to Google).

<?php
global $apiConfig;
?>

So What's the Point Of This Stupid Thing?

Pretty much just:

  • The ability to install and update this via the Sparks system
  • The ability to use SPARKPATH to integrate this a little easier within your CodeIgniter projects
  • The ability to keep this code isolated from the rest of your project, the Sparks way

Example Code/How To

Just as you would with using this API outside of CodeIgniter/Sparks:

  1. Get yourself a Google Account
  2. Register your project with Google, and obtain an oAuth Client ID and Client Secret via the "API Access" of your Google API Console. Decide what URL you want your users to be redirected to after successful oAuth authorization/authentication and enter that here as well. Take note of these three values.
  3. Enter these three values into the included src/config.php file where prompted.

You can now access these Google services via the included example code, included here (an example that fetches a list of calendars within your account) with the aforementioned path alterations for your convenience:

<?php
global $apiConfig;

require_once SPARKPATH . "GoogleAPIClient/0.6.0/src/apiClient.php";
require_once SPARKPATH . "GoogleAPIClient/0.6.0/src/contrib/apiCalendarService.php";

// init API
$apiClient = new apiClient();
$apiClient->setApplicationName("Google Calendar PHP Starter Application");
$apiClient->setUseObjects(true);

// init Google Calendar
$cal = new apiCalendarService($apiClient);

// authenticate/authorize user
if (isset($_SESSION['oauth_access_token'])) {
	$apiClient->setAccessToken($_SESSION['oauth_access_token']);
} else {
	$token = $apiClient->authenticate();
	$_SESSION['oauth_access_token'] = $token;
}

// list your calendars
if ($apiClient->getAccessToken()) {
	$calList = $cal->calendarList->listCalendarList();
	print "<h1>Calendar List</h1><pre>" . print_r($calList, true) . "</pre>";
	$_SESSION['token'] = $apiClient->getAccessToken();
} else {
	$authUrl = $apiClient->createAuthUrl();
	print "<a class='login' href='$authUrl'>Connect Me!</a>";
}
?>

The original Google README file is included below:

Google APIs Client Library for PHP

Description

The Google API Client Library enables you to work with Google APIs such as Buzz, Moderator, Tasks, or Latitude on your server.

Requirements:

Project page:

http://code.google.com/p/google-api-php-client

OAuth 2 instructions:

http://code.google.com/p/google-api-php-client/wiki/OAuth2

Report a defect or feature request here:

http://code.google.com/p/google-api-php-client/issues/entry

Subscribe to project updates in your feed reader:

http://code.google.com/feeds/p/google-api-php-client/updates/basic

Supported sample applications:

http://code.google.com/p/google-api-php-client/wiki/Samples

Basic Example

<?php
require_once 'path/to/src/apiClient.php';
require_once 'path/to/src/contrib/apiBooksService.php';

$client = new apiClient();
$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>');
}
Popular Spark Projects
Popular Google Projects
Popular Data Processing Categories

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Php
Google
Spark
Codeigniter
Api Client