asgoodasnu / google-spreadsheet-bundle
Integrates asimlqt/php-google-spreadsheet-client with Symfony2 and google/apiclient
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 2 591
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 20
Forks: 4
Open Issues: 2
Type:symfony-bundle
Requires
- asimlqt/php-google-spreadsheet-client: 2.3.7
- google/apiclient: 1.1.6
- symfony/framework-bundle: ~2.6
- symfony/yaml: ~2.6
Requires (Dev)
This package is not auto-updated.
Last update: 2019-12-05 11:39:24 UTC
README
The WkGoogleSpreadsheetBundle provides a Symfony2 service to interact with the Google Spreadsheet API using the asimlqt/php-google-spreadsheet-client library. It incorporates the google/apiclient to connect to Google via OAuth2 as a server to server application.
Installation
Require the bundle and its dependencies with composer:
$ composer require asgoodasnu/google-spreadsheet-bundle
Register the bundle:
// app/AppKernel.php public function registerBundles() { $bundles = array( new Wk\GoogleSpreadsheetBundle\WkGoogleSpreadsheetBundle(), ); }
Set the Google OAuth2 credentials in your project's config.yml
:
# config.yml wk_google_spreadsheets: credentials: client_email: "802199133289-frv8en7bgmr79ohtr777ibsp0uuhdk1g@developer.gserviceaccount.com" private_key: "%kernel.root_dir%/config/google.pem"
Providing your Google OAuth2 credentials
To interact with the Google Spreadsheet API you need to provide your Google OAuth2 service account credentials. Please head over to https://developers.google.com/identity/protocols/OAuth2ServiceAccount for more information on how to create a service account and obtain your service account key.
Usage
The service wk_google_spreadsheet
provides direct interaction with the Google Spreadsheet PHP Client. You can invoke all methods of the client directly on the service:
$service = $container->get('wk_google_spreadsheet'); $service->getSpreadsheets(); $service->getSpreadsheetById(); $service->getListFeed(); $service->getCellFeed();
See https://github.com/asimlqt/php-google-spreadsheet-client for a full documentation of the client and its methods.
Dependencies
asimlqt/php-google-spreadsheet-client
- Google Spreadsheet PHP Clientgoogle/apiclient
- Client library for Google APIssymfony/yaml
- Symfony Yaml Componentsymfony/framework-bundle
- Symfony FrameworkBundle
PHPUnit Tests
You can run the tests using the following command:
$ vendor/bin/phpunit
Resources
Symfony 2
Google Spreadsheet PHP Client
Google Sheets API (formerly called the Google Spreadsheets API)
Client library for Google APIs
https://github.com/google/google-api-php-client/tree/v1-master
Using OAuth2 service accounts for Server to Server Applications
https://developers.google.com/identity/protocols/OAuth2ServiceAccount