• Stars
    star
    100
  • Rank 339,607 (Top 7 %)
  • Language
    PHP
  • License
    GNU Lesser Genera...
  • Created over 6 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

👥 This package provides a user friendly way of interacting with Google Contacts via the Google People API.

👥 PHP Google People API

This package provides a user friendly way of interacting with Google Contacts via the Google People API.

Installation

PHP Google People API can be easily installed using Composer. Just run the following command from the root of your project.

composer require rapidwebltd/php-google-people-api

If you have never used the Composer dependency manager before, head to the Composer website for more information on how to get started.

Setup

To use this package, you need to authenticate with Google via OAuth 2. Thankfully, this is made easy by the PHP Google OAuth 2 Handler package.

You can run its guided setup script with the following command.

php vendor/rapidwebltd/php-google-oauth-2-handler/src/setup.php

This will guide you through the process of setting up a project, and logging into to the Google account that you wish to manage contacts for. When asked which scopes you require access to, enter the following.

https://www.googleapis.com/auth/userinfo.profile
https://www.googleapis.com/auth/contacts
https://www.googleapis.com/auth/contacts.readonly

When complete, you will have to code you need to create a GoogleOAuth2Handler object for this Google account.

You can then create a GooglePeople object, as follows.

$people = new GooglePeople($googleOAuth2Handler);

Usage

Retrieve all contacts

// Retrieval all contacts
foreach($people->all() as $contact) {
    echo $contact->resourceName.' - ';
    if ($contact->names) {
        echo $contact->names[0]->displayName;
    }
    echo PHP_EOL;
}

Retrieve a single contact

// Retrieve single contact (by resource name)
$contact = $people->get('people/c8055020007701654287');

Create a new contact

// Create new contact
$contact = new Contact($people);
$contact->names[0] = new stdClass;
$contact->names[0]->givenName = 'Testy';
$contact->names[0]->familyName = 'McTest Test';
$contact->save();

Update a contact

// Update contact
$contact->names[0]->familyName = 'McTest';
$contact->save();

Delete a contact

// Delete contact
$contact->delete();

More Repositories

1

php-google-contacts-v3-api

👥 PHP library for the Google Contacts API (v3)
PHP
103
star
2

php-switch-scripts

🔄 Scripts to aid in the setup of and switching between multiple PHP versions in Ubuntu 14.04 LTS or newer
Shell
69
star
3

array_undot

array_undot (the opposite of the array_dot helper function) expands a dot notation array into a full multi-dimensional array.
PHP
16
star
4

RW-File-Cache

🗄️ PHP File-based Caching Library
PHP
15
star
5

php-uk-bank-holidays

🏖️ PHP UK Bank Holidays lets developers easily retrieve UK bank holiday details.
PHP
13
star
6

Improved-Polymorphic-Eloquent-Builder

🔨 Improved Polymorphic Eloquent Builder
PHP
12
star
7

direct-share-buttons

A pure HTML & CSS implementation of interacting with social networks without the need of heavy JavaScript widgets.
CSS
10
star
8

php-countries

🌍 PHP Countries is a library that provides an elegant syntax to country data.
PHP
6
star
9

laravel-dynamic-menu

📃 Laravel Dynamic Menu provides the foundation to build dynamic database powered navigation menus for your web app.
PHP
6
star
10

php-google-oauth-2-handler

🔐 This package provides a handler to ease authentication with Google's OAuth 2 APIs.
PHP
6
star
11

bootstrap-styleguide

🎨 A Bootstrap style guide, aiming to display all the Bootstrap components on a single page, based off of the old Bootstrap 3 Theme Example
HTML
6
star
12

google-contacts-for-wordpress-plugin

👥 Google Contacts for WordPress Plugin
PHP
4
star
13

rw-git-deployment

Rapid Web Git Deployment system
PHP
4
star
14

permissions-editor-ninja-forms-plugin

Set which elements of Ninja Forms different user roles should have access to.
PHP
4
star
15

caching-object-wrapper

🎁 Wraps up any PHP object so all its methods are cached.
PHP
3
star
16

basic-js-cookie-banner

🍪 A basic JavaScript cookie banner (implied consent)
JavaScript
3
star
17

rapid-screensaver

💻 A pure CSS screensaver for our internal status monitor
JavaScript
3
star
18

upfront-child-theme-documentation

📄 WPMU DEV Upfront Child Theme Documentation
2
star
19

php-bucket-testing

🆎 PHP Bucket Testing, A/B testing, split testing
PHP
2
star
20

php-simple-google-maps-api

🗺 This library allows a user to easily communicate with the Google Maps API and retrieve a set of coordinates from an address.
PHP
2
star
21

mobile-checker

📱 A small service for checking if your website is mobile friendly using the Google Pagespeed API
HTML
2
star
22

simple-currency-rates

💱 This package provides simple access to current currency exchange rates.
PHP
2
star
23

backup-deletion

💾 Shell script to identify date named backups and remove them
Shell
2
star
24

amazon-mws-config-generator

Generate configuration files for PHP Amazon MWS library - https://github.com/CPIGroup/phpAmazonMWS
PHP
2
star
25

Search

🔍 Search allows you to easily add an intelligent search engine to your website or web application.
PHP
2
star
26

uxdm

🔀 UXDM helps developers migrate data from one system or format to another.
PHP
2
star
27

rapidwebltd.github.io

🌐 Rapid Web open source mini-site: https://rapidwebltd.github.io
HTML
1
star
28

laravel-5-package-creator

Package creator for Laravel 5 or 5.1
PHP
1
star
29

SimpleMailChimp

🐵 Simple MailChimp API wrapper
PHP
1
star
30

maintenance-page

🛠 A boilerplate that we at Rapid Web for displaying maintenance pages for live uploads, etc.
HTML
1
star
31

RW-File-Cache-PSR-6

🗄 PSR-6 adapter for RW File Cache
PHP
1
star
32

zebra-session-loader

🦓 Automatically start Zebra sessions (database powered sessions)
PHP
1
star
33

gulp-workflow

Our Gulp Workflow repo
1
star
34

amazon-mws-enums

PHP enums for Amazon MWS feeds
PHP
1
star
35

SimpleStripe

💳 SimpleStripe is a really easy way to integrate basic Stripe-powered payments.
PHP
1
star
36

no-post-data-laravel-middleware

No Post Data Laravel Middleware
PHP
1
star
37

php-postcodes

📬 This library handles various UK postcode related tasks
PHP
1
star
38

php-cli-progress-bar

⏱️ Progress bar for command line PHP scripts
PHP
1
star