PHPackages                             marshmeloo/yii2-asana - 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. [API Development](/categories/api)
4. /
5. marshmeloo/yii2-asana

ActiveYii2-extension[API Development](/categories/api)

marshmeloo/yii2-asana
=====================

Yii2 component for integration with asana via REST API

123PHP

Since Oct 18Pushed 11y ago1 watchersCompare

[ Source](https://github.com/marshmeloo/yii2-asana)[ Packagist](https://packagist.org/packages/marshmeloo/yii2-asana)[ RSS](/packages/marshmeloo-yii2-asana/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2 Asana
==========

[](#yii2-asana)

[Yii2 Asana](http://marshmeloo.github.io/yii2-Asana) is a component for [Yii2 framework](https://github.com/yiisoft/yii2) designed for integration with Asana CMS via XML-RPC API.

This component is built on top of [Asana XML-RPC PHP Client](https://github.com/letrunghieu/Asana-xmlrpc-client) by [Hieu Le Trung](https://github.com/letrunghieu).

[![Latest Stable Version](https://camo.githubusercontent.com/26284d31457546d16a91978b24cdf86a6220883fce6bcf3f9aa740161d708af1/68747470733a2f2f706f7365722e707567782e6f72672f6d617273686d656c6f6f2f796969322d4173616e612f762f737461626c652e737667)](https://packagist.org/packages/marshmeloo/yii2-Asana)[![Build Status](https://camo.githubusercontent.com/bbe6fb0020b7f8d2fd8d4542b79e7b73ec53e67c26a92ce78989d884e971d2f7/68747470733a2f2f7472617669732d63692e6f72672f6d617273686d656c6f6f2f796969322d4173616e612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/marshmeloo/yii2-Asana)[![Code Climate](https://camo.githubusercontent.com/34d117869a0ad61ed7b2273bfd4265721430b01d380eed2bddb4afc579fbc990/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6d617273686d656c6f6f2f796969322d4173616e612e706e67)](https://codeclimate.com/github/marshmeloo/yii2-Asana)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/53631d83509af6ba58992c18d22a92eb65d28c47ec2ccf8e593de90c00ab80c3/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d617273686d656c6f6f2f796969322d4173616e612f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/marshmeloo/yii2-Asana/?branch=master)[![Version Eye](https://camo.githubusercontent.com/141edf9c64942e2754d04bab9faa85cde22c9712a7d068ad77e538b00cf2da62/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f6d617273686d656c6f6f3a796969322d4173616e612f62616467652e737667)](https://www.versioneye.com/php/marshmeloo:yii2-Asana)[![License](https://camo.githubusercontent.com/d340990f8f0b5c2b3b681964a614951a3a219fc519fa7a2c44e5c61815d1ead3/68747470733a2f2f706f7365722e707567782e6f72672f6d617273686d656c6f6f2f796969322d4173616e612f6c6963656e73652e737667)](https://packagist.org/packages/marshmeloo/yii2-Asana)

Requirements
------------

[](#requirements)

- Yii 2.0 (dev-master)
- PHP 5.4
- PHP extension [XML-RPC](http://php.net//manual/en/book.xmlrpc.php)

> Note: This extension mandatorily requires [Yii Framework 2](https://github.com/yiisoft/yii2). The framework is under active development and the first stable release of Yii 2 is expected in early 2014.

Installation
------------

[](#installation)

The preferred way to install this extension is through [Composer](http://getcomposer.org/).

Either run

`php composer.phar require marshmeloo/yii2-Asana "dev-master"`

or add

` "marshmeloo/yii2-Asana": "dev-master"`

to the `require` section of your `composer.json` file.

Usage
-----

[](#usage)

### Component creation

[](#component-creation)

In order to use this extension, first thing you need to do is to create a `blog` (you can change the name if you want) component and configure it. Here is the example of minimal configuration (in your `config/main.php`):

```
    'components' => [
        ...
        'blog' => [
            'class' => '\marshmeloo\yii2wp\Asana',
            'endpoint' => 'http://example.com/xmlrpc.php',
            'username' => 'demo',
            'password' => 'demo'
        ]
        ...
    ]
```

### First API request

[](#first-api-request)

When component is configured, you can start making requests to your Asana site.

For example, get ten latest published posts. Select `guid`, `post_title` and `post_content` fields only:

```
    $blogPosts = Yii::$app->blog->getPosts([
        'post_status' => 'publish',
        'number' => 10
    ], ['guid', 'post_title', 'post_content']);
```

Or create a new post with title "New post" and content "Hello world!":

```
    $postID = Yii::$app->blog->newPost('New post', 'Hello world!');
```

### Caching request results

[](#caching-request-results)

Making API calls to an external application means delays. If you don't want your users to wait for a Asana response each time, caching is a right thing to do:

```
    // The user profile will be fetched from cache if available.
    // If not, the query will be made against XML-RPC API and cached for use next time.
    $profile = Yii::$app->blog->cache(function (Asana $blog) {
        return $blog->getProfile();
    });
```

In case, if you need something more complex, you can disable caching for some requests:

```
    $blogPosts = Yii::$app->blog->cache(function (Asana $blog) {

        // ... queries that use query cache ...

        return $blog->noCache(function (Asana $blog) {
            // this query will not use query cache
            return $blog->getPosts();
        });
    });
```

Caching will work for data retrieval queries only. Queries that create, update or delete records will not use caching component.

Configuration parameters
------------------------

[](#configuration-parameters)

#### `$endpoint`

[](#endpoint)

`string` Asana XML-RPC API endpoint URL.

#### `$username`

[](#username)

`string` Asana authentication username.

Please note, that any actions made by XML-RPC will be made on behalf of this user.

#### `$password`

[](#password)

`string` Asana authentication password.

#### `$proxyConfig`

[](#proxyconfig)

`array` Proxy server configuration.

This configuration array should follow the following format:

- `proxy_ip`: the ip of the proxy server (WITHOUT port)
- `proxy_port`: the port of the proxy server
- `proxy_user`: the username for proxy authorization
- `proxy_pass`: the password for proxy authorization
- `proxy_mode`: value for CURLOPT\_PROXYAUTH option (default to CURLAUTH\_BASIC)

Empty array means that no proxy should be used.

Default value: `[]`.

#### `$authConfig`

[](#authconfig)

`array` Server HTTP authentication configuration.

This configuration array should follow the following format:

- `auth_user`: the username for server authentication
- `auth_pass`: the password for server authentication
- `auth_mode`: value for CURLOPT\_HTTPAUTH option (default to CURLAUTH\_BASIC)

Empty array means that no HTTP authentication should be used.

Default value: `[]`.

#### `$catchExceptions`

[](#catchexceptions)

`boolean` Whether to catch exceptions thrown by Asana API, pass them to the log and return default value, or transmit them further along the call chain.

Default value: `true`.

#### `$enableQueryCache`

[](#enablequerycache)

`boolean` Whether to enable query caching.

Default value: `true`.

#### `$queryCacheDuration`

[](#querycacheduration)

`integer` The default number of seconds that query results can remain valid in cache.

Use 0 to indicate that the cached data will never expire.

Default value: `3600`.

#### `$queryCache`

[](#querycache)

`Cache|string` The cache object or the ID of the cache application component that is used for query caching.

Default value: `'cache'`.

List of available methods
-------------------------

[](#list-of-available-methods)

The full list of available methods can be found in [Asana XML-RPC PHP Client Class Reference](http://letrunghieu.github.io/Asana-xmlrpc-client/api/class-HieuLe.AsanaXmlrpcClient.AsanaClient.html).

Please note, that all those methods are throwing an exceptions in case of any errors. While this extension is configured (by default), in case of errors, to return an empty array for any data retrial methods and false for any create, update or delete methods. Please see `$catchExceptions` configuration option for details.

Errors logging
--------------

[](#errors-logging)

There are a lot of things that can go wrong (network problems, wrong Asana user permissions, etc.). If `$catchExceptions` configuration option is set to `true` (default value), this extension will catch them and pass to `marshmeloo\yii2wp\Asana::*` logging category.

In order to see them, you can configure your Yii2 `log` component to something similar to this:

```
    'components' => [
        ...
        'log' => [
            'targets' => [
                'file' => [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error'],
                    'categories' => ['marshmeloo\yii2wp\Asana::*'],
                ],
            ],
        ],
        ...
    ]
```

Report
------

[](#report)

- Report any issues [on the GitHub](https://github.com/marshmeloo/yii2-Asana/issues).

License
-------

[](#license)

**yii2-Asana** is released under the MIT License. See the bundled `LICENSE.md` for details.

Resources
---------

[](#resources)

- [Project Page](http://marshmeloo.github.io/yii2-Asana)
- [Packagist Package](https://packagist.org/packages/marshmeloo/yii2-Asana)
- [Source Code](https://github.com/marshmeloo/yii2-Asana)

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

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

---

Top Contributors

[![marshmeloo](https://avatars.githubusercontent.com/u/9282082?v=4)](https://github.com/marshmeloo "marshmeloo (7 commits)")

### Embed Badge

![Health badge](/badges/marshmeloo-yii2-asana/health.svg)

```
[![Health](https://phpackages.com/badges/marshmeloo-yii2-asana/health.svg)](https://phpackages.com/packages/marshmeloo-yii2-asana)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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