PHP code example of moovone / timekit-php-sdk

1. Go to this page and download the library: Download moovone/timekit-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

moovone / timekit-php-sdk example snippets


use Moovone\TimekitPhpSdk\GuzzleClient;

$httpClient = new GuzzleClient($apiKey);

$payload = [  
  'timezone' => 'Europe/Paris',  
  'name' => 'John Doe',  
];  
  
$resource = $this->httpClient->createResource($payload);

$payload = [  
  'timezone' => $timezone,  
  'first_name' => $firstName,  
  'last_name' => $lastName,  
  'name' => sprintf('%s %s', $firstName, $lastName),  
];  
  
$resource = $this->httpClient->createResource($payload);

$payload = [  
  'timezone' => $timezone,  
  'first_name' => $firstName,  
  'last_name' => $lastName,  
  'name' => sprintf('%s %s', $firstName, $lastName),  
];  
  
$this->httpClient->updateResource($resourceId, $payload);

$this->httpClient->deleteResource($resourceId);

$resource = $this->httpClient->getResource($resourceId);

$start = (new \DateTime())->modify('+1 hour');
$booking = $this->httpClient->createBooking($remoteId, $start, (clone $start)->modify('+30 minutes'), 'My first booking');

$this->httpClient->deleteBooking($bookingId);

use MoovOne\TimekitPhpSdk\Model\Booking;

$booking = $this->httpClient->updateBookingState($bookingId, Booking::STATE_CANCEL);

use MoovOne\TimekitPhpSdk\Model\Availability;

$payload = [
	'mode' => Availability::TYPE_ROUNDROBIN_RANDOM,
	'length' => '60 minutes',
	'round_to_nearest_hour' => false,
	'from' => 'tomorrow',
	'to' => '3 days',
	'buffer' => '5 minutes',
	'timeslot_increments' => '15 minutes',
	'resources' => [$resourceId],
];

$availabilities = $this->httpClient->getAvailabilities($payload);