|
1 | | -# Asana for Laravel 5 |
| 1 | +# Asana for Laravel |
2 | 2 |
|
3 | | -[](https://packagist.org/packages/torann/laravel-asana) [](https://packagist.org/packages/torann/laravel-asana) |
| 3 | +[](https://packagist.org/packages/torann/laravel-asana) |
| 4 | +[](https://packagist.org/packages/torann/laravel-asana) |
| 5 | +[](https://www.patreon.com/torann) |
| 6 | +[](https://gratipay.com/~torann) |
| 7 | +[](https://flattr.com/profile/torann) |
| 8 | +[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=4CJA2A97NPYVU) |
4 | 9 |
|
5 | | ----------- |
6 | | - |
7 | | -## Installation |
| 10 | +Asana API wrapper for Laravel, supporting workspaces, projects, tasks, tags, users and stories. |
8 | 11 |
|
9 | 12 | - [Laravel Asana on Packagist](https://packagist.org/packages/torann/laravel-asana) |
10 | 13 | - [Laravel Asana on GitHub](https://github.com/torann/laravel-asana) |
11 | | -- [Laravel 4 Installation](https://github.com/Torann/laravel-asana/tree/0.1.2) |
12 | | - |
13 | | -### Composer |
14 | | - |
15 | | -From the command line run: |
16 | | - |
17 | | -``` |
18 | | -$ composer require torann/laravel-asana |
19 | | -``` |
20 | | - |
21 | | -### Laravel |
22 | | - |
23 | | -Once installed you need to register the service provider with the application. Open up `config/app.php` and find the `providers` key. |
24 | | - |
25 | | -``` php |
26 | | -'providers' => [ |
27 | | - |
28 | | - \Torann\LaravelAsana\ServiceProvider::class, |
29 | | - |
30 | | -] |
31 | | -``` |
32 | | - |
33 | | -### Lumen |
34 | | - |
35 | | -For Lumen register the service provider in `bootstrap/app.php`. |
36 | | - |
37 | | -``` php |
38 | | -$app->register(\Torann\LaravelAsana\ServiceProvider::class); |
39 | | -``` |
40 | | - |
41 | | -### Facade |
42 | | - |
43 | | -This package also ships with a facade which provides the static syntax for creating collections. You can register the facade in the aliases key of your `config/app.php` file. |
44 | | - |
45 | | -```php |
46 | | -'aliases' => [ |
47 | | - 'Asana' => 'Torann\LaravelAsana\Facade', |
48 | | -] |
49 | | -``` |
50 | | - |
51 | | -### Publish the configurations |
52 | | - |
53 | | -Run this on the command line from the root of your project: |
54 | | - |
55 | | -``` |
56 | | -$ php artisan vendor:publish --provider="Torann\LaravelAsana\ServiceProvider" |
57 | | -``` |
58 | | - |
59 | | -A configuration file will be publish to `config/asana.php`. |
60 | | - |
61 | | -## Quick Examples |
62 | | - |
63 | | -#### Get a specific user |
64 | | - |
65 | | -```php |
66 | | -Asana::getUserInfo($user_id); |
67 | | -``` |
68 | | - |
69 | | -#### Get current user |
70 | | - |
71 | | -Will return the user's info of the owner of the Personal Access Token. |
72 | | - |
73 | | -```php |
74 | | -Asana::getCurrentUser(); |
75 | | -``` |
76 | | - |
77 | | -#### Get all users in all workspaces |
78 | | - |
79 | | -Will return the user's info of the owner of the Personal Access Token. |
80 | | - |
81 | | -```php |
82 | | -Asana::getUsers(); |
83 | | -``` |
84 | | - |
85 | | -#### Get task |
86 | | - |
87 | | -```php |
88 | | -Asana::getTask($task_id); |
89 | | -``` |
90 | | - |
91 | | -#### Get a task's sub-tasks |
92 | | - |
93 | | -```php |
94 | | -Asana::getSubTasks($task_id); |
95 | | -``` |
96 | | - |
97 | | -#### Creating a task |
98 | | - |
99 | | -```php |
100 | | -Asana::createTask([ |
101 | | - 'workspace' => '176825', // Workspace ID |
102 | | - 'name' => 'Hello World!', // Name of task |
103 | | - 'assignee' => ' [email protected]', // Assign task to... |
104 | | - 'followers' => ['3714136', '5900783'] // We add some followers to the task... (this time by ID) |
105 | | -]); |
106 | | -``` |
107 | | - |
108 | | -#### Delete a task |
109 | | - |
110 | | -```php |
111 | | -Asana::deleteTask($task_id); |
112 | | -``` |
113 | | - |
114 | | -#### Adding task to project |
115 | | - |
116 | | -```php |
117 | | -Asana::addProjectToTask($task_id, $project_id); |
118 | | -``` |
119 | | - |
120 | | -#### Remove task from a project |
121 | | - |
122 | | -```php |
123 | | -Asana::removeProjectToTask($task_id, $project_id); |
124 | | -``` |
125 | | - |
126 | | -#### Get task stories |
127 | | - |
128 | | -```php |
129 | | -Asana::getTaskStories($task_id); |
130 | | -``` |
131 | | - |
132 | | -#### Commenting on a task |
133 | | - |
134 | | -```php |
135 | | -Asana::commentOnTask($task_id, "Please please! Don't assign me this task!"); |
136 | | -``` |
137 | | - |
138 | | -#### Add a tag to a task |
139 | | - |
140 | | -```php |
141 | | -Asana::addTagToTask($task_id, $tag_id); |
142 | | -``` |
143 | 14 |
|
144 | | -#### Remove a tag from a task |
| 15 | +## Official Documentation |
145 | 16 |
|
146 | | -```php |
147 | | -Asana::removeTagFromTask($task_id, $tag_id); |
148 | | -``` |
| 17 | +Documentation for the package can be found on [Lyften.com](http://lyften.com/projects/laravel-asana/). |
149 | 18 |
|
150 | | -#### Create a project |
151 | | - |
152 | | -```php |
153 | | -Asana::createProject([ |
154 | | - "workspace" => "1768", |
155 | | - "name" => "Foo Project!", |
156 | | - "notes" => "This is a test project" |
157 | | -]); |
158 | | -``` |
159 | | - |
160 | | -#### Getting projects in all workspaces |
161 | | - |
162 | | -```php |
163 | | -Asana::getProjects(); |
164 | | -``` |
165 | | - |
166 | | -#### Get projects in a workspace |
167 | | - |
168 | | -```php |
169 | | -$archived = false; |
170 | | - |
171 | | -Asana::getProjectsInWorkspace($workspace_id, $archived); |
172 | | -``` |
173 | | - |
174 | | -#### Updating project info |
175 | | - |
176 | | -```php |
177 | | -Asana::updateProject($project_id, [ |
178 | | - 'name' => 'This is a new cool project!', |
179 | | - 'notes' => 'At first, it wasn't cool, but after this name change, it is!' |
180 | | -]); |
181 | | -``` |
182 | | - |
183 | | -#### Get project tasks |
184 | | - |
185 | | -```php |
186 | | -Asana::getProjectTasks($project_id); |
187 | | -``` |
188 | | - |
189 | | -#### Get project stories |
190 | | - |
191 | | -```php |
192 | | -Asana::getProjectStories($project_id); |
193 | | -``` |
194 | | - |
195 | | -#### Get a specific story |
196 | | - |
197 | | -```php |
198 | | -Asana::getSingleStory($story_id); |
199 | | -``` |
200 | | - |
201 | | -#### Comment on a project |
202 | | - |
203 | | -```php |
204 | | -$text = "Such fun!"; |
205 | | - |
206 | | -Asana::commentOnProject($project_id, $text) |
207 | | -``` |
208 | | - |
209 | | -#### Get a specific tag |
210 | | - |
211 | | -```php |
212 | | -Asana::getTag($tag_id); |
213 | | -``` |
214 | | - |
215 | | -#### Get tags |
216 | | - |
217 | | -```php |
218 | | -Asana::getTags(); |
219 | | -``` |
220 | | - |
221 | | -#### Update tag |
222 | | - |
223 | | -```php |
224 | | -// $data - array - An array containing fields to update, see Asana API if needed. |
225 | | - |
226 | | -Asana::updateTag($tag_id, $data); |
227 | | -``` |
228 | | - |
229 | | -#### Get tasks with tag |
230 | | - |
231 | | -```php |
232 | | -Asana::getTasksWithTag($tag_id); |
233 | | -``` |
234 | | - |
235 | | -#### Get workspaces |
236 | | - |
237 | | -```php |
238 | | -Asana::getWorkspaces(); |
239 | | -``` |
240 | | - |
241 | | -#### Update workspace |
242 | | - |
243 | | -```php |
244 | | -$data = ['name' => '']; |
245 | | - |
246 | | -Asana::updateWorkspace($workspace_i, $data); |
247 | | -``` |
248 | | - |
249 | | -#### Get workspace tasks |
250 | | - |
251 | | -```php |
252 | | -// Assignee can either be 'me' or a user's ID |
253 | | - |
254 | | -Asana::getWorkspaceTasks($workspace_id, $assignee); |
255 | | -``` |
256 | | - |
257 | | -#### Get workspace tags |
258 | | - |
259 | | -```php |
260 | | -Asana::getWorkspaceTags($workspace_id); |
261 | | -``` |
262 | | - |
263 | | -#### Get workspace users |
264 | | - |
265 | | -```php |
266 | | -Asana::getWorkspaceUsers($workspace_id); |
267 | | -``` |
268 | | - |
269 | | -#### Filtering |
270 | | - |
271 | | -If you specify an assignee, you must also specify a workspace to filter on. |
272 | | - |
273 | | -```php |
274 | | -Asana::getTasksByFilter([ |
275 | | - 'assignee' => 1121, |
276 | | - 'project' => 37373729, |
277 | | - 'workspace' => 111221 |
278 | | -]); |
279 | | -``` |
280 | | - |
281 | | -## Upgrading |
| 19 | +## Change Log |
282 | 20 |
|
283 | | -### Upgrade from v0.2 to v0.3 |
| 21 | +#### v0.4.0 |
284 | 22 |
|
285 | | -Asana stopped supporting API keys, so now we must use a Personal Access Token. See Asana's directions for generating a [personal access tokens](https://asana.com/guide/help/api/api#gl-access-tokens). Then update the `config/asana.php` config file with the new token: |
| 23 | +- Added attachment |
| 24 | +- Code cleanup |
| 25 | +- Add helper function |
286 | 26 |
|
287 | | -```php |
288 | | -'accessToken' => env('ASANA_TOKEN'), |
289 | | -``` |
| 27 | +#### v0.3.1 |
290 | 28 |
|
291 | | -## Change Log |
| 29 | +- Fix big integers parsing |
| 30 | +- Fix `getTasksByFilter` ignoring filters beside the predefined ones |
292 | 31 |
|
293 | 32 | #### v0.3.0 |
294 | 33 |
|
|
0 commit comments