PHPackages                             gwa/google-data-contact - 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. gwa/google-data-contact

ActiveLibrary[API Development](/categories/api)

gwa/google-data-contact
=======================

v0.3.3(7y ago)0316PHP

Since Aug 28Pushed 7y ago1 watchersCompare

[ Source](https://github.com/gwa/google-data-contact)[ Packagist](https://packagist.org/packages/gwa/google-data-contact)[ RSS](/packages/gwa-google-data-contact/feed)WikiDiscussions master Synced yesterday

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

google-data-contact
===================

[](#google-data-contact)

PHP library to generate **Google Data Contact XML** used for adding contacts via the [Domain Shared Contacts API](https://developers.google.com/admin-sdk/domain-shared-contacts/).

See

Usage
-----

[](#usage)

NOTE: Not all fields are currently implemented.

### Implemented

[](#implemented)

- `gd:name`
- `atom:content` (note)
- `gd:email`
- `gd:phoneNumber`
- `gd:structuredPostalAddress`
- `gd:organization`

### Creating a Contact from scratch

[](#creating-a-contact-from-scratch)

Annotated example:

```
use Gwa\GoogleContact\Contact;

// Create a new contact.
$contact = new Contact();

// Set the name.
// Arguments: last, first, middle
$contact->setName('Doe', 'John')
    // Prefix and suffix can also be set
    ->setNamePrefix('Dr.')
    ->setNameSuffix('MD');

// Add a note.
$contact->setNote('Lorem ipsum');

// Add one or more email addresses.
// Arguments: address, type (opt.), is primary? (opt.)
$contact->addEmail('doe@example.org', 'home', true);
// Type defaults to "work"
$contact->addEmail('doe@example.com');

// Add one or more phone numbers.
// Arguments: number, type (opt.), is primary? (opt.)
$contact->addPhoneNumber('012 3456 789', 'home', true);

// Add one or more addresses.
$contact->addAddress('1600 Amphitheatre Parkway', 'work', true)
    ->setCity('Mountain View')
    ->setRegion('California')
    ->setPostCode('94043')
    // Arguments: County, Country code (opt.) https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
    ->setCountry('U.S.A.', 'US');

// Add one or more organizations.
// Arguments: name, type (opt.), is primary? (opt.)
$contact->addOrganization('Google, Inc.')
    ->setType('other')
    ->setLabel('Volunteer')
    ->setPrimary()
    ->setTitle('Tech Writer')
    ->setJobDescription('Writes documentation')
    ->setDepartment('Software Development')
    ->setSymbol('GOOG');

// Access existing elements using 0-based index:
$email1 = $contact->email(0);
$email2 = $contact->email(1);
$phonenumber1 = $contact->phoneNumber(0);
$address1 = $contact->address(0);
$organization1 = $contact->organization(0);

// Render as XML.
$xmlstring = $contact->render();
```

The following XML is rendered:

```

    John
    Doe
    Dr.
    MD

  Lorem ipsum

  012 3456 789

    1600 Amphitheatre Parkway
    Mountain View
    California
    U.S.A.

    Google, Inc.
    Tech Writer
    Writes documentation
    Software Development
    GOOG

```

### Creating from XML return from the Google Domain Shared Contacts API

[](#creating-from-xml-return-from-the-google-domain-shared-contacts-api)

The XML for feed looks as follows (source: )

```

  https://www.google.com/m8/feeds/contacts/example.com/base
  2008-03-05T12:36:38.836Z

  example.com's Contacts

    example.com
    example.com

    Contacts

  1
  1
  25

      https://www.google.com/m8/feeds/contacts/example.com/base/c9012de

    2008-03-05T12:36:38.835Z

    Fitzgerald

      Fitzgerald

      456

```

Given the XML string, `Contact` instances can be created using the `ContactFactory`.

```
use Gwa\GoogleContact\ContactFactory;

$factory = new ContactFactory();
// XML above is in $xml. Returns an array of Contact objects.
$contacts = $factory->createFromFeedXmlString($xml);
```

Given the XML for single entry, a single `Contact` instance can be created.

```
$factory = new ContactFactory();
// XML above is in $xml. Returns a single Contact object.
$contact = $factory->createFromXmlString($xml);
```

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

8

Last Release

2858d ago

### Community

Maintainers

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

---

Top Contributors

[![gwagroves](https://avatars.githubusercontent.com/u/8222012?v=4)](https://github.com/gwagroves "gwagroves (13 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gwa-google-data-contact/health.svg)

```
[![Health](https://phpackages.com/badges/gwa-google-data-contact/health.svg)](https://phpackages.com/packages/gwa-google-data-contact)
```

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.3M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24015.5M18](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172437.8k11](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

94452.6k6](/packages/botman-driver-telegram)

PHPackages © 2026

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