Download the PHP package rapidwebltd/php-google-contacts-v3-api without Composer

On this page you can find all versions of the php package rapidwebltd/php-google-contacts-v3-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-google-contacts-v3-api

PHP Google Contacts v3 API

Packagist

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 package instead. It is more capable than this package and uses a newer API which will probably be supported for longer.

Installation & Dependencies

This package and its dependencies can be installed using composer.

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

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 https://console.developers.google.com/ under 'APIs & auth' -> '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

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

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

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.

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

Google Contact properties are accessed as follows.

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.

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.

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.

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

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.


All versions of php-google-contacts-v3-api with dependencies

PHP Build Version
Package Version
Requires php Version >=5.2.1
google/apiclient Version >=1.1.4 <2.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package rapidwebltd/php-google-contacts-v3-api contains the following files

Loading the files please wait ....