PHPackages                             razik440/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. [API Development](/categories/api)
4. /
5. razik440/php-google-contacts-v3-api

ActiveLibrary[API Development](/categories/api)

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

PHP library for the Google Contacts API (v3)

v1.4.2(9y ago)037MITPHPPHP &gt;=5.2.1

Since Nov 27Pushed 8y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (8)Used By (0)

php-google-contacts-v3-api
==========================

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

PHP library for the Google Contacts API (v3)

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;
```

### 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';

$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";

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

### 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

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 64.9% 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 ~87 days

Recently: every ~38 days

Total

7

Last Release

3299d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ccfc975cc311fa6c30a208f109d2b72493806a5f76a74ce5db6c4aa860a82d58?d=identicon)[razik](/maintainers/razik)

---

Top Contributors

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

---

Tags

phpgooglecontacts

### Embed Badge

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

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

###  Alternatives

[google-gemini-php/client

Gemini API is a supercharged PHP API client that allows you to interact with the Gemini API

402986.7k21](/packages/google-gemini-php-client)[jeroendesloovere/geolocation-php-api

This Geolocation PHP class connects to Google Maps API to find latitude/longitude or address.

75316.8k4](/packages/jeroendesloovere-geolocation-php-api)[x-fran/g-trends

Google Trends API for PHP

11955.6k](/packages/x-fran-g-trends)[gemini-api-php/laravel

Gemini API client for Laravel

8915.7k](/packages/gemini-api-php-laravel)[aurawindsurfing/google-translate

Free Laravel package for Paid Google Translate REST API with your own API key

1119.5k1](/packages/aurawindsurfing-google-translate)

PHPackages © 2026

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