rapidwebltd/php-google-people-api 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

rapidwebltd/php-google-people-api

Composer 安装命令:

composer require rapidwebltd/php-google-people-api

包简介

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

README 文档

README

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();

rapidwebltd/php-google-people-api 适用场景与选型建议

rapidwebltd/php-google-people-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 243.64k 次下载、GitHub Stars 达 103, 最近一次更新时间为 2018 年 02 月 19 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 rapidwebltd/php-google-people-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 rapidwebltd/php-google-people-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 rapidwebltd/php-google-people-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 243.64k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 103
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 103
  • Watchers: 9
  • Forks: 38
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0-only
  • 更新时间: 2018-02-19