PHPackages                             rapidwebltd/php-google-contacts-v3-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. rapidwebltd/php-google-contacts-v3-api

ActiveLibrary

rapidwebltd/php-google-contacts-v3-api
======================================

PHP library for the Google Contacts API (v3)

v2.0.0(8y ago)102149.9k↓100%60[15 issues](https://github.com/rapidwebltd/php-google-contacts-v3-api/issues)[2 PRs](https://github.com/rapidwebltd/php-google-contacts-v3-api/pulls)MITPHPPHP &gt;=5.2.1

Since Nov 27Pushed 5y ago23 watchersCompare

[ Source](https://github.com/rapidwebltd/php-google-contacts-v3-api)[ Packagist](https://packagist.org/packages/rapidwebltd/php-google-contacts-v3-api)[ Docs](https://github.com/rapidwebltd/php-google-contacts-v3-api)[ RSS](/packages/rapidwebltd-php-google-contacts-v3-api/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (1)Versions (9)Used By (0)

PHP Google Contacts v3 API
==========================

[](#php-google-contacts-v3-api)

[![Packagist](https://camo.githubusercontent.com/21f3a00e0b7abf20d022e0b4562852032eb9b169bb20a45259cd89e918c8ed90/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72617069647765626c74642f7068702d676f6f676c652d636f6e74616374732d76332d6170692e737667)](https://packagist.org/packages/rapidwebltd/php-google-contacts-v3-api/stats)

PHP library for the Google Contacts API (v3)

**💡 NOTE: If you're starting a new project, we strongly recommend using our [PHP Google People API](https://github.com/rapidwebltd/php-google-people-api) package instead. It is more capable than this package and uses a newer API which will probably be supported for longer.**

Installation &amp; Dependencies
-------------------------------

[](#installation--dependencies)

This package and its dependencies can be installed using `composer`.

Just run `composer require rapidwebltd/php-google-contacts-v3-api`.

Setup
-----

[](#setup)

1. Install required dependencies. See the 'Dependencies' section above.
2. Copy or rename `.config_blank.json` to `.config.json`. Note the dot (`.`) at the beginning of the file name.
3. Fill in the `clientID`, `clientSecret` and `redirectUri` in `.config.json`.

- Note that `redirectUri` should be configure to point towards the `redirect-handler.php` file.
- The `clientID` and `clientSecret` can be found in the Google Developers console at  under 'APIs &amp; auth' -&gt; 'Credentials', after enabling the Contacts API.

4. Go to `authorise-application.php` in a web browser. This should give you a URL to authorise your application for Google Contacts.
5. Go to the authorisation URL provided by the previous step.
6. Accept the permissions requested on the page displayed. You should then be redirected back to the `redirect-handler.php` file.
7. The page generated by the `redirect-handler.php` file should then present you with a refresh token. Copy this into your `.config.json`.
8. Setup is done!

Usage
-----

[](#usage)

After the library has been installed and the setup and account association steps have been completed, you can make use of the library.

If your framework does not do this for you, remember to include the require the `vendor/autoload.php` file on any pages you wish to make use of this library on.

### Retrieving Google Contacts

[](#retrieving-google-contacts)

The following code will retrieve all contacts from the associated Google account.

```
$contacts = rapidweb\googlecontacts\factories\ContactFactory::getAll();

var_dump($contacts);
```

The `ContactFactory::getAll()` method will return an array of `Contact` objects. The contact's details will be available as public member variables of these objects.

The `selfURL` contained within each `Contact` object is the unique reference to this particular contact. If you need to retrieve a specific contact in the future, you will need to store this `selfURL`.

To retrieve a specific contact (by its selfURL), use the following code.

```
$selfURL = "...";

$contact = rapidweb\googlecontacts\factories\ContactFactory::getBySelfURL($selfURL);

var_dump($contact);
```

This `ContactFactory::getBySelfURL` method will return a single `Contact` object.

Google Contact properties are accessed as follows.

```
$selfURL = "...";

$contact = rapidweb\googlecontacts\factories\ContactFactory::getBySelfURL($selfURL);

echo $contact->name;
echo $contact->phoneNumber;
echo $contact->email;
echo $contact->content;
```

### Updating existing Google Contacts

[](#updating-existing-google-contacts)

The updating of Google Contacts using this library is done in a very object orientated manner.

You must first retrieve a `Contact` object using one of the methods mentioned previously. You can then modify the contact object's public member variables. To save these changes back to the Google Contacts service, you then pass the modified object to the `ContactFactory::submitUpdates($contact)` method.

The following code demonstrates in full retrieving a contact, modifying it and submitting the updates.

```
$selfURL = "...";

$contact = rapidweb\googlecontacts\factories\ContactFactory::getBySelfURL($selfURL);

var_dump($contact);

$contact->name = 'Test';
$contact->phoneNumber = '07812363789';
$contact->email = 'test@example.com';
$contact->content = 'Note for example';

$contactAfterUpdate = rapidweb\googlecontacts\factories\ContactFactory::submitUpdates($contact);

var_dump($contactAfterUpdate);
```

### Creating new Google Contacts

[](#creating-new-google-contacts)

Creating a new Google Contact is very easy. Simply call the `ContactFactory::create($name, $phoneNumber, $emailAddress)` method, passing through appropriate parameters. This method will return the created contact as a `Contact` object including its newly assigned `selfURL`.

```
$name = "Frodo Baggins";
$phoneNumber = "06439111222";
$emailAddress = "frodo@example.com";
$note = "Note for example";

$newContact = rapidweb\googlecontacts\factories\ContactFactory::create($name, $phoneNumber, $emailAddress, $note);
```

### Config file override

[](#config-file-override)

Each method has optional argument for config file override. It is useful when you want to use work with multiple Google accounts at the same time.

```
$customConfig = (object) array(
    'clientID' => '',
    'clientSecret' => '',
    'redirectUri' => '',
    'developerKey' => '',
    'refreshToken' => ''
);

$contacts = ContactFactory::getAll($customConfig);
```

You have to define all variables as the original config is completely ignored. To be more precise, it doesn't have to exist at all.

Examples
--------

[](#examples)

Take a look at the following files for basic examples of how to retrieve contacts. They can also be used to ensure you have currently associated your Google account with the library.

- test.php
- test\_individual.php

###  Health Score

40

—

FairBetter than 87% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 74.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~97 days

Recently: every ~61 days

Total

8

Last Release

3130d ago

Major Versions

v1.4.2 → v2.0.02017-10-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/c580cdf7c14898fff179cdfc1085892091d5d2f49d917873a12365af9ac77c93?d=identicon)[Jord-JD](/maintainers/Jord-JD)

---

Top Contributors

[![Jord-JD](https://avatars.githubusercontent.com/u/650645?v=4)](https://github.com/Jord-JD "Jord-JD (29 commits)")[![lucascdsilva](https://avatars.githubusercontent.com/u/4581253?v=4)](https://github.com/lucascdsilva "lucascdsilva (6 commits)")[![mgi1982](https://avatars.githubusercontent.com/u/530722?v=4)](https://github.com/mgi1982 "mgi1982 (3 commits)")[![resand](https://avatars.githubusercontent.com/u/5307015?v=4)](https://github.com/resand "resand (1 commits)")

---

Tags

googlegoogle-apigoogle-contactsphp-libraryretrieve-contactsphpgooglecontacts

### Embed Badge

![Health badge](/badges/rapidwebltd-php-google-contacts-v3-api/health.svg)

```
[![Health](https://phpackages.com/badges/rapidwebltd-php-google-contacts-v3-api/health.svg)](https://phpackages.com/packages/rapidwebltd-php-google-contacts-v3-api)
```

###  Alternatives

[redjanym/php-firebase-cloud-messaging

PHP SDK for Firebase Cloud Messaging from Google

39847.9k1](/packages/redjanym-php-firebase-cloud-messaging)[tomatophp/filament-accounts

Manage your multi accounts inside your app using 1 table with multi auth and a lot of integrations

748.3k7](/packages/tomatophp-filament-accounts)[tomatophp/filament-seo

Manage and generate SEO tags and integrate your website with Google SEO services

112.6k1](/packages/tomatophp-filament-seo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
