PHPackages                             ajimix/asana-api-php-class - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. ajimix/asana-api-php-class

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

ajimix/asana-api-php-class
==========================

A dependency free, lightweight PHP class that acts as wrapper for Asana API. Lets make things fast and easy! :)

6.5.0(5y ago)14173.4k↓44.3%66[1 issues](https://github.com/ajimix/asana-api-php-class/issues)Apache-2.0PHPPHP &gt;=5.4.0

Since Mar 10Pushed 3y ago16 watchersCompare

[ Source](https://github.com/ajimix/asana-api-php-class)[ Packagist](https://packagist.org/packages/ajimix/asana-api-php-class)[ Docs](https://github.com/ajimix/asana-api-php-class)[ RSS](/packages/ajimix-asana-api-php-class/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (9)DependenciesVersions (39)Used By (0)

Asana API PHP class
===================

[](#asana-api-php-class)

A dependency free, lightweight PHP class that acts as wrapper for Asana API.
Lets make things fast and easy! :)

Installing
----------

[](#installing)

Choose your favourite flavour

- Download the php class from Github.
- Or use [Packagist](https://packagist.org/packages/ajimix/asana-api-php-class) PHP package manager.

Finally require the asana.php file.

Working with the class
----------------------

[](#working-with-the-class)

First declare the asana class

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

*Optionally you can pass an accessToken instead of a personalAccessToken if you use OAuth. Read [Using Asana Oauth Tokens](#using-asana-oauth-tokens) below for more info.*

#### Creating a task

[](#creating-a-task)

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

Creating a task for another assignee than yourself will mark the task as private by default. This results in the task not being available for modification through the API anymore. Take a look at the [API Reference](https://asana.com/developers/api-reference/tasks)for more fields of the Task you can directly pass to `createTask`.

#### Adding task to project

[](#adding-task-to-project)

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

#### Commenting on a task

[](#commenting-on-a-task)

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

#### Getting projects in all workspaces

[](#getting-projects-in-all-workspaces)

```
$asana->getProjects();
```

#### Updating project info

[](#updating-project-info)

```
$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!'
]);
```

#### Do more

[](#do-more)

There are a [lot more methods](https://github.com/ajimix/asana-api-php-class/blob/master/asana.php) to do almost everything with asana.

See the examples [inside examples folder](https://github.com/ajimix/asana-api-php-class/tree/master/examples), read the comments on the class file for class magic and read [Asana API documentation](http://developer.asana.com/documentation/) if you want to be a master.

If a method returned some data, you can always retrieve it by calling.

```
$asana->getData();
```

If you miss some functionality, open a pull request and it will be merged as soon as possible.

Enjoy ;D

Using Asana OAuth tokens
------------------------

[](#using-asana-oauth-tokens)

To use this API, you can also create an App on Asana to get an oAuth access token, then include the class:

```
require_once('asana-oauth.php');
```

Declare the oAuth class as:

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

Where YOUR\_APP\_ID, YOUR\_APP\_SECRET and CALLBACK\_URL you get from your App's details on Asana. Now, redirect the browser to the result held by $url. The user will be asked to login &amp; accept your app, after which the browser will be returned to the CALLBACK\_URL, which should process the result:

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

And you will receive an object with the access token and a refresh token The token expires after one hour so you can refresh it doing the following:

```
$asanaAuth->refreshAccessToken('ACCESS_TOKEN');
```

For a more detailes instructions on how to make oauth work check the example in examples/oauth.php

Author
------

[](#author)

**Twitter:** [@ajimix](http://twitter.com/ajimix)

**GitHub:** [github.com/ajimix](https://github.com/ajimix)

**Contributors:** [view contributors](https://github.com/ajimix/asana-api-php-class/graphs/contributors)

### Copyright and license

[](#copyright-and-license)

Copyright 2022 Ajimix

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community30

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 78.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~68 days

Recently: every ~217 days

Total

38

Last Release

1950d ago

Major Versions

1.0.0 → 2.0.02014-03-19

2.14.0 → 3.0.02015-11-23

3.1.0 → 4.0.02016-06-24

4.3.0 → 5.0.02017-03-02

5.1.1 → 6.0.02018-05-11

PHP version history (2 changes)1.0.0PHP &gt;=5.3.0

5.0.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e0ab8ebf5fa4c4e67ae8bfff09b282767518ceadf32d18b53ca8a09e8f962cd5?d=identicon)[ajimix](/maintainers/ajimix)

---

Top Contributors

[![ajimix](https://avatars.githubusercontent.com/u/30565?v=4)](https://github.com/ajimix "ajimix (158 commits)")[![nickbreslin](https://avatars.githubusercontent.com/u/267296?v=4)](https://github.com/nickbreslin "nickbreslin (7 commits)")[![igorhim](https://avatars.githubusercontent.com/u/4836291?v=4)](https://github.com/igorhim "igorhim (4 commits)")[![airesvsg](https://avatars.githubusercontent.com/u/396668?v=4)](https://github.com/airesvsg "airesvsg (3 commits)")[![helmo](https://avatars.githubusercontent.com/u/104120?v=4)](https://github.com/helmo "helmo (3 commits)")[![javifr](https://avatars.githubusercontent.com/u/353755?v=4)](https://github.com/javifr "javifr (3 commits)")[![mnunes01](https://avatars.githubusercontent.com/u/6908949?v=4)](https://github.com/mnunes01 "mnunes01 (3 commits)")[![jeff-greco](https://avatars.githubusercontent.com/u/3189664?v=4)](https://github.com/jeff-greco "jeff-greco (2 commits)")[![xbakesx](https://avatars.githubusercontent.com/u/714423?v=4)](https://github.com/xbakesx "xbakesx (2 commits)")[![mroach](https://avatars.githubusercontent.com/u/79006?v=4)](https://github.com/mroach "mroach (2 commits)")[![vdespa-collab](https://avatars.githubusercontent.com/u/68944255?v=4)](https://github.com/vdespa-collab "vdespa-collab (2 commits)")[![eflage](https://avatars.githubusercontent.com/u/1068402?v=4)](https://github.com/eflage "eflage (1 commits)")[![EHLOVader](https://avatars.githubusercontent.com/u/701725?v=4)](https://github.com/EHLOVader "EHLOVader (1 commits)")[![rvanlaak](https://avatars.githubusercontent.com/u/2707563?v=4)](https://github.com/rvanlaak "rvanlaak (1 commits)")[![sammythesm](https://avatars.githubusercontent.com/u/4318804?v=4)](https://github.com/sammythesm "sammythesm (1 commits)")[![Shagshag](https://avatars.githubusercontent.com/u/2842314?v=4)](https://github.com/Shagshag "Shagshag (1 commits)")[![sikker](https://avatars.githubusercontent.com/u/181665?v=4)](https://github.com/sikker "sikker (1 commits)")[![stephen304](https://avatars.githubusercontent.com/u/981915?v=4)](https://github.com/stephen304 "stephen304 (1 commits)")[![frankcrissalem](https://avatars.githubusercontent.com/u/7681587?v=4)](https://github.com/frankcrissalem "frankcrissalem (1 commits)")[![gvlasov](https://avatars.githubusercontent.com/u/4467948?v=4)](https://github.com/gvlasov "gvlasov (1 commits)")

---

Tags

asanaasana-apioauthphpwrapperapiasana

### Embed Badge

![Health badge](/badges/ajimix-asana-api-php-class/health.svg)

```
[![Health](https://phpackages.com/badges/ajimix-asana-api-php-class/health.svg)](https://phpackages.com/packages/ajimix-asana-api-php-class)
```

###  Alternatives

[pmill/aws-cognito

A PHP client for AWS Cognito user pools

74266.5k3](/packages/pmill-aws-cognito)[mollie/oauth2-mollie-php

Mollie Provider for OAuth 2.0 Client

261.8M1](/packages/mollie-oauth2-mollie-php)[blockvis/civic-sip-php

The Civic Secure Identity Platform (SIP) API client.

117.8k1](/packages/blockvis-civic-sip-php)[kakadu-dev/yii2-jwt-auth

Extension provide JWT auth for Yii2

105.8k](/packages/kakadu-dev-yii2-jwt-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
