PHPackages                             arturgrigio/google-laravel-calendar-2 - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. arturgrigio/google-laravel-calendar-2

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

arturgrigio/google-laravel-calendar-2
=====================================

Manage events on a Google Calendar

1.1.0(9y ago)62.7k2[2 issues](https://github.com/ArturGrigio/google-laravel-calendar-2/issues)MITPHPPHP ^7.0

Since Sep 15Pushed 9y ago1 watchersCompare

[ Source](https://github.com/ArturGrigio/google-laravel-calendar-2)[ Packagist](https://packagist.org/packages/arturgrigio/google-laravel-calendar-2)[ Docs](https://github.com/ArturGrigio/google-laravel-calendar-2)[ RSS](/packages/arturgrigio-google-laravel-calendar-2/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

Manage events on a Google Calendar
==================================

[](#manage-events-on-a-google-calendar)

This package is originally by [Spatie](https://spatie.be/opensource). It was using [Google API 1.1.7](https://github.com/google/google-api-php-client/tree/1.1.7), but I couldn't get the key to work properly, so I ended up reimplementing the `$client` with `OAuth2`. Here is an example of what you can do with the repo:

```
use Arturgrigio\GoogleCalendar\Event;

//create a new event
$event = new Event;

$event->name = 'A new event';
$event->startDateTime = Carbon\Carbon::now();
$event->endDateTime = Carbon\Carbon::now()->addHour();

$event->save();

// get all future events on a calendar
$events = Event::get();

$firstEvent = $events->first();
$firstEvent->name = 'updated name';
$firstEvent->save();

// create a new event
Event::create([
   'name' => 'A new event'
   'startDateTime' => Carbon\Carbon::now(),
   'endDateTime' => Carbon\Carbon::now()->addHour(),
]);

// delete an event
$event->delete();
```

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require arturgrigio/google-laravel-calendar-2
```

Next up the service provider must be registered:

```
'providers' => [
    ...
    Arturgrigio\GoogleCalendar\GoogleCalendarServiceProvider::class,
];
```

Optionally the `Spatie\GoogleCalendar\GoogleCalendarFacade` must be registered:

```
'aliases' => [
	...
    'GoogleCalendar' => Arturgrigio\GoogleCalendar\GoogleCalendarFacade::class,
    ...
]
```

You must publish the configuration with this command:

```
php artisan vendor:publish --provider="Arturgrigio\GoogleCalendar\GoogleCalendarServiceProvider"
```

This will publish file called `laravel-google-calendar.php` in your config-directory with this contents:

```
