libcast/highrise

Highrise API client

v1.0.6 2014-08-27 13:25 UTC

This package is not auto-updated.

Last update: 2024-12-21 14:58:25 UTC


README

This library is a full rewrite of Highrise-PHP-Api aiming to improve usability and stick with modern PHP practices.

New features include:

  • PHP 5.3 namespaces
  • Composer support
  • Ability to list global subject fields
  • Ability to add custom fields to a Person
  • Ability of deleting a email address of a Person

Existing features in original library:

  • People
  • Tasks
  • Notes
  • Emails
  • Tags
  • Users

Installation

The recommended way to install libcast/highrise is to use Composer:

$ composer require libcast/highrise

Usage

People

Create a new person and set his address:

use Highrise\Resources\HighrisePerson;

$person = new HighrisePerson($highrise);
$person->setFirstName("John");
$person->setLastName("Doe");
$person->addEmailAddress("johndoe@gmail.com");

$address = new HighriseAddress();
$address->setAddress("165 Test St.");
$address->setCity("Glasgow");
$address->setCountry("Scotland");
$address->setZip("GL1");
$person->addAddress($address);

$person->save();

Find people by search term:

$people = $highrise->findPeopleBySearchTerm("John");
foreach($people as $p) {
    print $person->getFirstName() . "\n";
}

Notes

Print all notes:

foreach($highrise->findAllPeople() as $person) {
    print_r($person->getNotes());
}

Create a new note:

$note = new HighriseNote($highrise);
$note->setSubjectType("Party");
$note->setSubjectId($person->getId());
$note->setBody("Test");
$note->save();

Tags

Add tags:

$people = $highrise->findPeopleByTitle("CEO");
foreach($people as $person) {
    $person->addTag("CEO");
    $person->save();
}
```php

Remove Tags:

```php
$people = $highrise->findPeopleByTitle("Ex-CEO");
foreach($people as $person) {
    unset($person->tags['CEO']);
    $person->save();
}

Find all tags:

$all_tags = $highrise->findAllTags();
print_r($all_tags);

Tasks

Create task:

$task = new HighriseTask($highrise);
$task->setBody("Task Body");
$task->setPublic(false);
$task->setFrame("Tomorrow");
$task->save();

Assign all upcoming tasks:

$users = $highrise->findAllUsers();
$user = $users[0]; // just select the first user

foreach($highrise->findUpcomingTasks() as $task) {
    $task->assignToUser($user);
    $task->save();
}
```php

Find all assigned tasks:

```php
$assigned_tasks = $highrise->findAssignedTasks();
print_r($assigned_tasks);

Users

Find all users:

$users = $highrise->findAllUsers();
print_r($users);

Find current user:

$me = $highrise->findMe();