Google Calendar Guide

Google Calendar Guide


The first thing you’ll need to do is get credentials to use Google's API. I’m assuming that you’ve already created a Google account and are signed in. Head over to Google API console and click "Select a project" in the header.

1

Next up we must specify which APIs the project may consume. From the header, select "Enable APIs and Services".

2




On the next page, search for "Calendar" and select "Google Calendar API" from the list.

3


From here, press "Enable" to enable the Google Calendar API for this project.

4

Now that you've created a project that has access to the Calendar API it's time to download a file with these credentials. Click "Credentials" in the sidebar and then press the "Credentials in APIs & Services" link.

5


From this page, open the "Create credentials" drop-down and select "Service account key".

6


On the next screen, you can give the service account a name. You can name it anything you’d like. In the service account id you’ll see an email address. We’ll use this email address later on in this guide. Select "JSON" as the key type and click "Create" to download the JSON file. You will get a warning that the service account does not have a role, you can safely ignore this and create the service account without assigning a role.

If you have delegated domain-wide access to the service account and you want to impersonate a user account, specify the email address of the user account in the config file.

7

Save the json inside your Laravel project at the location specified in the service_account_credentials_json key of the config file of this package. Because the json file contains potentially sensitive information, I don't recommend committing it to your git repository.

Now that everything is set up on the API site, we’ll need to configure some things on the Google Calendar site. Head over to Google Calendar and view the settings of the calendar you want to work with via PHP. On the "Share with specific people" tab press the "Add people" button and add the service account id that was displayed when creating credentials on the API site.

8

9


Scroll down to the "Integrate calendar" section to see the id of the calendar. You need to specify that id in the config file.

10