weeek/weeek-client-php

v1.0.0 2023-07-21 18:33 UTC

This package is auto-updated.

Last update: 2024-04-21 20:30:47 UTC


README

Weeek is a multi-service platform that helps you make work more productive.

This package implements API that you can learn more about at developers.weeek.net

Installation

This package can be installed through Composer.

composer require weeek/weeek-client-php

You will also need to install packages that "provide" psr/http-client-implementation and psr/http-factory-implementation. More info at php-http.org.

For example, you can use Guzzle

composer guzzlehttp/guzzle http-interop/http-factory-guzzle:^1.0

Getting started

<?php

require_once __DIR__ . '/vendor/autoload.php';

use Weeek\Client;

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

$client = new Client($accessToken);

Examples

Get workspace info

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

$workspaceInfo = $response->info;

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

$workspaceMembers = $response->members;

Work with tasks

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

$createdTask = $response->task;

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

Work with deals

$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;