PHP code example of goldnead / statamic-clientrooms

1. Go to this page and download the library: Download goldnead/statamic-clientrooms 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/ */

    

goldnead / statamic-clientrooms example snippets


// config/statamic-clientrooms.php
'container' => 'clientrooms',
'disk' => 'local',

// Which paid product opens a room. Kinds are `type` values from statamic-products.
'open_on_product_types' => ['sessions'],
'open_on_products' => [],               // handles, whatever their kind

'allowed_extensions' => ['pdf', 'doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'png', 'jpg', 'jpeg', 'mp3', 'mp4', 'zip'],

'default_owner' => env('CLIENTROOMS_DEFAULT_OWNER'),   // user id or e-mail
'download_ttl_minutes' => 30,
'timeline_limit' => 100,

use Goldnead\ClientRooms\Facades\ClientRooms;

$room = ClientRooms::open('[email protected]', $ownerUserId, ['name' => 'Maria Beispiel']);
$room = ClientRooms::open($leadhubContact);           // links contact_id, takes the brand
ClientRooms::close($room);
ClientRooms::reopen($room);                          // or open() again

ClientRooms::forEmail('[email protected]');          // ?ClientRoom, current brand
ClientRooms::forUser(User::current());               // by the user's address

$task = ClientRooms::addTask($room, 'Send the recording', now()->addWeek(), null, [
    'description' => 'Two minutes, quiet, no click.',
    'type' => 'exercise',                            // see config `task_types`
    'priority' => 'high',                            // low|medium|high|urgent
    'estimated_minutes' => 15,
]);

ClientRooms::updateTask($task, ['priority' => 'low']);   // only the keys you hand over
ClientRooms::publishTask($task, false);              // back to draft: the client stops seeing it
$submission = ClientRooms::submitTask($task, 'Here is my recording.', [$uploadedFile]);
ClientRooms::submissionDownloadUrl($submission->files[0]);   // signed, expires
ClientRooms::removeSubmission($submission);          // takes its files off the disk too

ClientRooms::completeTask($task);                    // idempotent, one event
ClientRooms::reopenTask($task);

$session = ClientRooms::recordSession($room, 'Lesson 12', now(), [
    'duration_minutes' => 60,
    'protocol' => 'We worked on the passaggio …',   // what the client reads
    'notes' => 'Pushes on the high A.',             // never leaves the Control Panel
]);

// The same write with an identity attached: called twice with one external id,
// this updates rather than duplicates. That is what makes a backfill safe to
// re-run and a webhook safe to retry.
$session = ClientRooms::importSession($room, 'a4f1…-vf-session-uuid', [
    'title' => 'Lesson 12',
    'held_at' => '2026-08-14T10:30:00+00:00',       // any moment a date parser reads
    'status' => 'completed',                        // the sending system's own word
    'published_status' => 'published',              // absent → draft, the safe side
    'protocol' => '…',
    'recording_url' => $temporaryUrl,
    'recording_url_expires_at' => now()->addHours(6),
    'has_transcript' => true,
    'meta' => ['external_booking_id' => 'cal-778'],
]);

ClientRooms::updateSession($session, ['summary' => 'Good progress.']);
ClientRooms::publishSession($session, false);        // back to draft
ClientRooms::removeSession($session);

$file = ClientRooms::attach($room, $uploadedFile, 'Practice plan', visibleToClient: true);
ClientRooms::downloadUrl($file);                     // signed, expires

ClientRooms::timeline($room);                        // ['mode', 'entries', 'sources', 'stats', 'total']

$session->hasRecording();     // a recording exists — a fact about the sitting
$session->recordingUrl();     // …and null once the link is no longer worth handing out
$session->hasTranscript();    // reported by the sender, link or no link
$session->transcriptUrl();
bash
composer migrate
php please clientrooms:install          # creates the asset container
php please vendor:publish --tag=statamic-clientrooms-config