# Installation

Just add this to your composer.json and then run composer update.

"rossedman/teamwork": "~1.0"

# Configuration With Laravel

This wrapper comes with support for Laravel 5. This includes a service provider as well as a facade for easy access. Once this package is pulled into your project just add this to your config/app.php file.

'providers' => [

and then add the facade to your aliases array

'aliases' => [
  'Teamwork' => 'Rossedman\Teamwork\Facades\Teamwork',

Add To Services

If you are using Laravel then add a teamwork array to your config/services.php file

'teamwork' => [
    'key'  => 'YourSecretKey',
    'url'  => 'YourTeamworkUrl'


If you are using the Facade with Laravel youc an easily access Teamwork like this


If you want to use dependency injection to make your application easy to test the Service Provider binds Rossedman\Teamwork\Factory. Here is an example of how to use it with dependency injection

Route::get('/test', function(Rossedman\Teamwork\Factory $teamwork) {
   $activity = $teamwork->activity()->latest();

# Configuration Without Laravel

If you are not using Laravel you can instantiate and use Teamwork. Once you instantiate these classes you can use the class as shown in the examples.

require "vendor/autoload.php";

use GuzzleHttp\Client as Guzzle;
use Rossedman\Teamwork\Client;
use Rossedman\Teamwork\Factory as Teamwork;

$client     = new Client(new Guzzle, 'YourSecretKey', 'YourTeamworkUrl');
$teamwork   = new Teamwork($client);

# Account

// Get details of the account.

// Authenticate the account.

# Activity

// Get the latest activity for all of Teamwork
$teamwork->activity()->latest(['maxItems' => 10]);

// Get only starred activity by the account your are using.
$teamwork->activity()->latest(['onlyStarred' => 1]);

// Delete a specific activity by ID

# Company

// Retrieve all companies

// Retrieve company by ID

// Create a company! Aha! Business!
    "name" => "Satan Inc.",
    "address_one" => "666 Deathzone Rd.",
    "zip" => "66666",
    "city" => "Lake Of Fire",
    "state" => "Hellworld",
    "countrycode" => "US"

// Update a company
    "name" => "Clients From Hell"

// Delete a company

// Get people associated with company

# Milestones

// Get all milestones in Teamwork.

// Get all milestones and get progress of each milestone.
$teamwork->milestones()->all(['getProgress' => 'true']);

// Find a specific milestone by id

// Find milestone by ID with tasks, task lists and progress.
   'getProgress' => 'true',
   'showTaskLists' => 'true',
   'showTasks' => 'true'

# People

// Gather all the peoples

// Paginate people
$teamwork->people()->all(['page' => "3", "pageSize" => "10"]);

// Get a person by email address
$teamwork->people()->all(['emailaddress' => '[email protected]']);

// Create a person
    "first-name" => "Warlock",
    "last-name" => "Mastermind",
    "email-address" => "[email protected]",
    "user-type" => "account",
    "user-name" => "Deathlok"

// Update a person
    "first-name" => "Nero"

// Delete a person

// Find out who you are logged in as

// Get all API Keys For site admin only

# Projects

Projects have the most associated with them and are the most complicated to use. Below are all the methods associated with the Projects class.

// Get all projects in Teamwork.

// Find a specific project by ID.

// Create a project
    "name" => "My New Amazing Project",
    "description" => "This is a project that I will dedicate my whole life too",
    "companyId" => "999"

// Update a project
    "name" => "Satan, The Project"

// Delete a project

// Get the latest activity
$teamwork->project($projectID)->activity(['maxItems' => 5]);

// Get all companies involved in a project.

// Get all people associated with a project.

// Get starred projects

// Star or unstar a project

// Get all links on a project

// Get the time totals for a project.

// Retrieve latest messages and archived messages

// Get all milestones

// Create a milestone associated with a project
    "title" => "Save The World",
    "description" => "You must save the world in the next few days",
    "deadline" => "20150402",
    "notify" => true,
    "reminder" => true

# Task

// Get all tasks.

// You can also filter tasks by many different parameters that are
// listed here in the Teamwork developers docs. This example
// shows how to filter by tasks that are overdue and then
// order them by date.
$teamwork->task()->all(['filter' => 'overdue', 'sort' => 'duedate']);

// Retrieve a task by id

// Retrieve a task by id and exclude files and subtasks.
$teamwork->task($id)->find(['getFiles' => 'false', 'nestSubTasks' => 'true]);

// Complete and uncomplete a task.

# Tasklist

// Find a specific tasklist

// Update a tasklist
    'name' => 'Change The Name'

// Delete a tasklist

// Get time totals for a tasklist

// Get tasklists associated with a project