Access to google contacts through the google people API
Overview
This package provides all classes and functions to manage the contacts of a Google account.
Access is via the Google Perons API with OAuth2 authentication.
The following functionalities are supported:
- Login and authentication to the google account
- List contacts
- Search in contacts
- Filter contacts per conatct group (-> Label)
- create / edit / delete contacts
- list contact groups
- create / edit / delete contact groups
- assign /remove contacts to contact groups
- set / remove contact photos
The package only uses the standard PHP cURL library and have no further dependencies
to any other 3rd party libraries or packages.
The fact that on almost every mobile phone that runs under Android, the contacts are managed either
with the Google Contacts or with a compatible app and are also automatically be synchronised with
the Google account contacts (with the appropriate setting), makes this package interesting for
management- and/or synchronization purposes.
Usage
A smart example of using the package is provided. This example is only intended to demonstrate
the use of the package. The UI is only coded 'quick and dirty', contains no validations and should
therefore only be used as a starting point for your own implementation.
Take a lock at the files
- ContactList.php
- ContactDetails.php
- DoAction.php
- GoogleLogin.php
- GoogleOauth2Callback.php
The starting point is the file ´ContactList.php´
A complete documentation of the classes and a detailed description, how to create your own
credential to access the google API can be found at https://github.com/Stefanius67/GContacts/wiki
Logging
This package can use any PSR-3 compliant logger. The logger is initialized with a NullLogger-object
by default. The logger of your choice have to be passed to the constructor of the ´GClient´ class.
If you are not working with a PSR-3 compatible logger so far, this is a good opportunity
to deal with this recommendation and may work with it in the future.
There are several more or less extensive PSR-3 packages available on the Internet.
You can also take a look at the
'XLogger'
package and the associated blog
'PSR-3 logging in a PHP application'
as an introduction to this topic.