PHP Wrapper Library for Harvest API

UPDATE: Current Release details and download available here

Harvest Users may or may not be familiar with the Harvest API that can be used to access and manipulate timesheets, clients, projects, tasks, and more. Since Harvests creation they have been integrating with other 3rd party applications and to communicate information across channels they created the Harvest API.

Harvest users can use this same API to utilize information in their Harvest account in their own applications.  Currently their is an open-sourced Harvest Ruby wrapper that can be from github. But as I prefer to utilize PHP I have created a PHP Wrapper Library for the Harvest API.  Currently the API requires cURL support and can be utilized to obtain information from your harvest account but not modification of data. Over the next few months I will be expanding this to include the rest of the functionality of the API.

Example Usage

  1. Require the HarvestAPI main class
    require_once( dirname(__FILE__) . '/HarvestAPI.php' );
  2. Register the Auto Loader
    spl_autoload_register(array('HarvestAPI', 'autoload') );
  3. Set Account & User information
    $api = new HarvestAPI();
    $api->setUser( "user@email.com" );
    $api->setPassword( "password" );
    $api->setAccount( "account" );
  4. Query the API for desired information
    $result = $api->getClient( 1-----  );
    $result = $api->getProjects();
  5. Check if request was successfull
    if( $result->isSuccess() ) {
      ...
    }
  6. If successful use the information
    $project = $result->data;
    echo "Name: " . $project->name;
    echo "Id: " . $project->id;
    echo "Active: " . $project->active;

Contact

Currently the library is in its first phase so you may encounter some bugs, or issues If you do so please contact me with the details. Also if you find that you need a particular feature of the Harvest API that is currently not supported please also let me know so I can know where to focus my development efforts. I hope that you will find this useful and if you do feel free to leave a comment.

Download

Resources

// Harvest // PHP //

Comments & Questions

Add Your Comment