Download the PHP package synara/sdk without Composer
On this page you can find all versions of the php package synara/sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sdk
Synara PHP SDK
A model-first PHP SDK for the Synara API. Build events with a fluent, immutable API and manage them through resource classes.
Installation
Quick Start
Timezone requirement: the Synara API expects ISO 8601 timestamps with timezone offsets. Make sure your
DateTimeImmutablevalues include an offset (e.g.2024-01-15T10:00:00-08:00).
Resources & Requests
Client exposes typed resources. Each resource turns models into HTTP payloads for you, so you never have to hand-craft JSON.
$client->events()->create(Event $event): Event$client->events()->find(string $uid): Event$client->events()->update(string $uid, Event $event): Event
Every response is converted back into immutable model instances, ready for fluent reuse.
Creating Events
Build an event with Event::make() and then chain fluent modifiers. Every method returns a new immutable instance.
The SDK automatically serializes this model into a JSCalendar jsevent payload when you call create() or update(). You work with PHP models; the SDK handles converting them to JSON that Synara understands.
Adding Attendees
Attendees are added using the fluent API:
Updating Events
Because models are immutable, every modifier returns a new instance. Persist updates by sending the modified model back to the resource.
Finding Events
Error Handling
The SDK throws specific exceptions for different error scenarios:
Custom HTTP Client
You can inject a custom PSR-18 HTTP client:
Model Properties
Event
getUid(): string- Event unique identifiergetTitle(): string- Event titlegetStartsAt(): DateTimeInterface- Event start timegetDuration(): ?DateInterval- Event duration (if set)getDescription(): ?string- Event description (if set)getLocation(): ?string- Event location (if set)getAttendees(): array- Array of Attendee objectsgetStatus(): string- Event status (default: 'confirmed')
Attendee
getEmail(): string- Attendee email addressgetName(): ?string- Attendee name (if set)getKind(): string- Attendee kind (default: 'individual')getRole(): ?string- Attendee role (e.g., 'optional')getRsvpStatus(): ?string- RSVP status, e.g. 'accepted', 'declined', 'needs-action' (or null if not set)
Serialization & Payloads
Event::toArray()returns a PHP associative array that matches the JSCalendarjseventshape. The SDK JSON-encodes this structure whenever it calls the Synara API.Attendee::toArray()returns the JSCalendar participant structure (email, optional name, role, RSVP status, etc.).
Example JSCalendar output:
Testing
Run the test suite:
The test suite includes:
- EventModelTest - Tests for Event model immutability, fluent API, and serialization
- AttendeeModelTest - Tests for Attendee model methods and serialization
- EventsResourceTest - Tests for Events resource with mocked HTTP client
Immutability
All models are immutable. Methods like withDuration(), withDescription(), addAttendee(), etc., return new instances:
License
MIT