PHP code example of mikkelson / clubhouse-php

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

    

mikkelson / clubhouse-php example snippets






use Mikkelson\Clubhouse;

    
    $token = '213901-dk9AJ-3SOJ-8dj9-KAAa0smsa';

    $clubhouse = new Clubhouse($token);


$epic_id = '3000';

$epic = $clubhouse->get('epics', $epic_id);

$epic_id = "4351";

$data = [
    'description' => 'Keep your developers happy by providing detailed descriptions (-;',
    'state' => 'to do'
];

$update = $clubhouse->update('epics', $epic_id, $data);

$epic_id = '3000';

$clubhouse->delete('epics', $epic_id);

$epics = $clubhouse->get('epics');

$new_epic = [
    'deadline' => '2020-08-16T12:30:00Z',
    'name' => 'Terraforming of Mars',
    'description' => 'Should be easy. Couple of astropeople, a trowel each. Easy.'
];

$epic = $clubhouse->create('epics', $new_epic);

$file_id = '3000';

$file = $clubhouse->get('files', $file_id);

$file_id = "4351";

$data = [
    'description' => 'This file contains all of my most important passwords, in plain text.',
    'name' => 'Paswords.txt'
];

$update = $clubhouse->update('files', $file_id, $data);

$file_id = '3000';

$clubhouse->delete('files', $file_id);

$files = $clubhouse->get('files');

$new_label = [
    'external_id' => 'thirdparty-id-123',
    'name' => 'My New Label'
];

$label = $clubhouse->create('labels', $new_label);

$label_id = "1234";

$data = [
    'name' => 'Updated Label Name'
];

$label = $clubhouse->update('labels', $label_id, $data);

$label_id = '3000';

$clubhouse->delete('labels', $label_id);

$labels = $clubhouse->get('labels');

$link_id = 5000;

$linked_files = $clubhouse->get('linked-files', $link_id);

$new_link = [
    'name' => 'My Linked File',
    'description' => 'Description of the file',
    'type' => 'dropbox',
    'url' => 'http://dropbox.com/1sjsSA9Q/asd20j.txt
];

$linked_file = $clubhouse->create('linked-files', $new_link);

$link_id = "1234";

$data = [
    'name' => 'New name for linked file',
    'description' => 'Description of new linked file'
];

$linked_file = $clubhouse->update('linked-files', $link_id, $data);

$link_id = '3000';

$clubhouse->delete('linked-files', $link_id);

$linked_files = $clubhouse->get('linked-files');

$project_id = '2990';

$project = $clubhouse->get('projects', $project_id);

$new_project = [
    'name' => 'New Clubhouse Project',
    'description' => 'Description of the project',
    'abbreviation' => 'ncp'
];

$project = $clubhouse->create('projects', $new_project);

$project_id = 1234;

$data = [
    'name' => 'New name for project',
    'description' => 'Description update text'
];

$project = $clubhouse->update('projects', $project_id, $data);

$project_id = 3000;

$clubhouse->delete('projects', $project_id);

$projects = $clubhouse->get('projects');

$new_link = [
    'object_id' => 100,
    'subject_id' => 250,
    'verb' => 'blocks' //blocks, relates, duplicates
];

$story_links = $clubhouse->create('story-links', $new_link);

$storylink_id = 3000;

$story_links = $clubhouse->get('story-links', $storylink_id);

$storylink_id = 3000;

$clubhouse->delete('story-links', $storylink_id);

$params = [
    'archived' => true,
    'text' => 'code refactoring' //Full text search on Story names, comments, and descriptions.
];

$stories = $clubhouse->create('stories/search', $params);

$new_story = [
    'name' => 'New story with some tasks',
    'project_id' => 6,
    'story_type' => 'feature', //feature, chore, bug
    'description' => 'Fuller descriptions make you more friends.',
    'tasks' => [
        ['description' => 'Task description 1'],
        ['description' => 'Task description 2']
    ]
];

$story = $clubhouse->create('stories', $new_story);

$story_id = 2000;

$story = $clubhouse->get('stories', $story_id);

$story_id = 1234;

$data = [
    'epic_id' => 29,
    'description' => 'Description update text'
];

$story = $clubhouse->update('stories', $story_id, $data);

$story_id = 300';

$clubhouse->delete('stories', $story_id);

$users = $clubhouse->get('users');

$user_id = '4JDaa9k-29d3-40s2-a4dc-a9bsd29sc';

$user = $clubhouse->get('users', $user_id);

$workflows = $clubhouse->get('workflows');

composer