PHP code example of ajimix / asana-api-php-class

1. Go to this page and download the library: Download ajimix/asana-api-php-class 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/ */

    

ajimix / asana-api-php-class example snippets


$asana = new Asana([
    'personalAccessToken' => 'GET_IT_FROM_ASANA'
]);

$asana->createTask([
   'workspace' => '176825', // Workspace ID
   'name' => 'Hello World!', // Name of task
   'assignee' => '[email protected]', // Assign task to...
   'followers' => ['3714136', '5900783'] // We add some followers to the task... (this time by ID)
]);

$asana->addProjectToTask('THIS_TASK_ID_PLEASE', 'TO_THIS_COOL_PROJECT_ID');

$asana->commentOnTask('MY_BEAUTIFUL_TASK_ID', 'Please please! Don\'t assign me this task!');

$asana->getProjects();

$asana->updateProject('COOL_PROJECT_ID', [
    'name' => 'This is a new cool project!',
    'notes' => 'At first, it wasn\'t cool, but after this name change, it is!'
]);

$asana->getData();



$asanaAuth = new AsanaAuth('YOUR_APP_ID', 'YOUR_APP_SECRET', 'CALLBACK_URL');
$url = $asanaAuth->getAuthorizeUrl();

$code = $_GET['code'];
$asanaAuth->getAccessToken($code);

$asanaAuth->refreshAccessToken('ACCESS_TOKEN');