PHP code example of weeek / weeek-client-php

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

    

weeek / weeek-client-php example snippets




eeek\Client;

$accessToken = "<your-access-token>";

$client = new Client($accessToken);

# Get workspace info
$response = $client->workspace->info();

$workspaceInfo = $response->info;

# Get workspace members
$response = $client->workspace->members();

$workspaceMembers = $response->members;

# Create a task
$response = $client->taskManager->tasks->create(['title' => 'My task']);

$createdTask = $response->task;

# Delete the task
$client->taskManager->tasks->destroy($createdTask->id);

$statusId = '<funnel-status-id>';

# Create a deal 
$response = $client->crm->deals->create($statusId, [
    'title'  => 'My deal',
    'amount' => 100.01
]);

$createdDeal = $response->deal;

# Create a subtask
$response = $client->crm->deals->createSubtask($createdDeal->id, ['title' => 'Deal subtask']);

$createdSubtask = $response->task;
bash
composer