PHP code example of wimdevgroup / personizer-php

1. Go to this page and download the library: Download wimdevgroup/personizer-php 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/ */

    

wimdevgroup / personizer-php example snippets



Wimdevgroup\PersonizerPhp\PersonizerClient;

// Client mit Kalender-ID oder Token initialisieren
$client = new PersonizerClient('your-calendar-id-or-token');

// Alle Events abrufen (Standardeinstellungen)
$events = $client->getEvents();

// Events mit verschiedenen Filteroptionen abrufen
$events = $client->getEvents([
    'query' => 'Meeting',           // Filter nach Titelinhalt
    'limit' => 20,                  // Maximale Anzahl Events (Standard: 10, Max: 100)
    'future_only' => true,          // Nur zukünftige Events (Standard: true)
    'days_ahead' => 30,             // Events der nächsten X Tage
    'today' => false                // Nur heutige Events (Standard: false)
]);

// Nur Events von heute
$todayEvents = $client->getEvents(['today' => true]);

// Events der nächsten 7 Tage mit "Termin" im Titel
$weekEvents = $client->getEvents([
    'query' => 'Termin',
    'days_ahead' => 7,
    'limit' => 50
]);

// Alle vergangenen und zukünftigen Events
$allEvents = $client->getEvents([
    'future_only' => false,
    'limit' => 100
]);

[
    'title' => 'Event Titel',
    'start' => '2024-01-15T10:00:00+01:00',    // ISO 8601 Format
    'end' => '2024-01-15T11:00:00+01:00',      // ISO 8601 Format oder null
    'description' => 'Event Beschreibung',
    'location' => 'Event Ort'
]

try {
    $events = $client->getEvents();
} catch (\RuntimeException $e) {
    echo "Fehler beim Abrufen der Kalenderdaten: " . $e->getMessage();
} catch (\InvalidArgumentException $e) {
    echo "Ungültige Parameter: " . $e->getMessage();
}
bash
composer