Pular para o conteúdo
← Voltar para projetos

Laravel Calendly

A lightweight Calendly REST API client for Laravel.

Laravel Calendly

#Laravel Calendly

Tests PHPStan Code Style Latest Version on Packagist Total Downloads License

A lightweight Calendly REST API client for Laravel. It wraps the api.calendly.com v2 endpoints behind a small static client, threads your Personal Access Token, and defensively returns null (rather than throwing) on network failures or non-2xx responses.

#Features

  • Usersme() fetches the authenticated user
  • Event typeseventTypes() and eventType()
  • Scheduled eventsevents(), event(), cancelEvent(), eventInvitees()
  • AvailabilityavailableTimes() and userBusyTimes()
  • Webhookswebhooks(), createWebhook(), deleteWebhook()
  • OrganizationsorganizationMembers()

#Installation

composer require jeffersongoncalves/laravel-calendly

Optionally publish the config file:

php artisan vendor:publish --tag="laravel-calendly-config"

#Configuration

Add to your .env:

CALENDLY_TOKEN=eyJra...

Create a Personal Access Token from your Calendly integrations settings.

#Config Options

// config/calendly.php
return [
    'token' => env('CALENDLY_TOKEN'),
    'timeout' => (int) env('CALENDLY_TIMEOUT', 8),
];

When calendly.token is null the client falls back to config('services.calendly.token').

#Usage

use JeffersonGoncalves\Calendly\CalendlyClient;

// Users
$me = CalendlyClient::me();

// Event types
$eventTypes = CalendlyClient::eventTypes(user: $me['resource']['uri']);
$eventType = CalendlyClient::eventType('AAAAAAAAAAAAAAAA');

// Scheduled events
$events = CalendlyClient::events(user: $me['resource']['uri'], params: ['status' => 'active']);
$event = CalendlyClient::event('AAAAAAAAAAAAAAAA');
CalendlyClient::cancelEvent('AAAAAAAAAAAAAAAA', 'Rescheduling');
$invitees = CalendlyClient::eventInvitees('AAAAAAAAAAAAAAAA');

// Availability
$slots = CalendlyClient::availableTimes(
    eventType: 'https://api.calendly.com/event_types/AAAAAAAAAAAAAAAA',
    startTime: '2026-09-06T00:00:00Z',
    endTime: '2026-09-13T00:00:00Z',
);
$busy = CalendlyClient::userBusyTimes(
    user: $me['resource']['uri'],
    startTime: '2026-09-06T00:00:00Z',
    endTime: '2026-09-13T00:00:00Z',
);

// Webhooks
$webhooks = CalendlyClient::webhooks(organization: $me['resource']['current_organization']);
CalendlyClient::createWebhook(
    url: 'https://example.com/webhooks/calendly',
    events: ['invitee.created', 'invitee.canceled'],
    organization: $me['resource']['current_organization'],
);
CalendlyClient::deleteWebhook('AAAAAAAAAAAAAAAA');

// Organization members
$members = CalendlyClient::organizationMembers($me['resource']['current_organization']);

All methods return array<string, mixed>|null (or bool for deleteWebhook()), returning null/false on any network failure or non-2xx response instead of throwing. eventTypes() and events() throw InvalidArgumentException when neither user nor organization is provided, since Calendly requires at least one.

#Testing

composer test

#Static Analysis

composer analyse

#Code Formatting

composer format

#Changelog

Please see CHANGELOG for more information on what has changed recently.

#License

The MIT License (MIT). Please see License File for more information.

Nova versão disponível.