PHPackages                             opendns/autotask-php - 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. opendns/autotask-php

ActiveLibrary

opendns/autotask-php
====================

A SOAP client wrapper for talking to Autotask's Web Service

v1.0.3(2y ago)61132.6k—0%32BSD-3-ClausePHPPHP &gt;=7.4.0

Since Jun 13Pushed 2y ago21 watchersCompare

[ Source](https://github.com/opendns/autotask-php)[ Packagist](https://packagist.org/packages/opendns/autotask-php)[ Docs](http://github.com/opendns/autotask-php)[ RSS](/packages/opendns-autotask-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)DependenciesVersions (30)Used By (0)

This library is not actively maintained or monitored.
=====================================================

[](#this-library-is-not-actively-maintained-or-monitored)

Introduction
============

[](#introduction)

autotask-php is designed to make it easier to interact with the Autotask Web Services API by providing interfaces that actually match the official documentation.

All objects that are exposed by Autotask have wrapper classes located in the `src/AutotaskObjects` folder.

If you find any bugs, or have feature requests, please file an issue in [GitHub](https://github.com/opendns/autotask-php) or open a pull request.

#### This client is under *active development*, and therefore has no stable version.

[](#this-client-is-under-active-development-and-therefore-has-no-stable-version)

Installation
============

[](#installation)

Composer
--------

[](#composer)

Ensure that composer is [installed on your machine](https://getcomposer.org/doc/00-intro.md). You will need to create a `composer.json` file in the root directory of your application.

```
{
    "require": {
        "opendns/autotask-php": "dev-master"
    }
}
```

Once the `composer.json` file is created, follow these steps from composer to [install the autotask-php package](https://getcomposer.org/doc/00-intro.md#using-composer).

Composer creates its own autoloader. Include `vendor/autoload.php` in your application config file and you will have full access to the autotask-php client.

Manual
------

[](#manual)

1. download the zip or clone the git repo from [GitHub](https://github.com/opendns/autotask-php)
2. if necessary, extract the zip to your desired location
3. add a `require_once` call to include `src/autoload.php`to get access to the Client.

```
require_once __DIR__ . '/src/autoload.php';
```

Usage
=====

[](#usage)

Supports both current versions of the Autotask's API; v1.6 and v1.5.

Version 1.6
-----------

[](#version-16)

Starting with version 1.6, Autotask only allows 'API User' type and all calls must include an integration code in the header. Please refer to Autotask's Web Services documentation in Autotask's help center for setting up the API User account and generating the integration code.

You can set your WSDL file or use the auto detect ()

You can set the integration code with you instantiate your client or after the fact. On every API call, the client will check if the version is 1.6 and confirm the integration code is set (except on getZoneInfo()). If one is not found, it will throw and error.

### Fetch your zone WSDL and setting your integration code (instantiation process)

[](#fetch-your-zone-wsdl-and-setting-your-integration-code-instantiation-process)

```
// This code is designed to find your exact wsdl location.
// If you already know your zone's wsdl URL, you can skip
// this step.
$username = 'admin@happymsp.biz';
$password = 'VeryVeryVeryVerySecurePassword';
$authWsdl = 'https://webservices.autotask.net/atservices/1.6/atws.wsdl';
$integrationCode = '27-character ID';
$opts = array('trace' => 1);
$client = new ATWS\Client($authWsdl, $opts, $integrationCode);
$zoneInfo = $client->getZoneInfo($username);

print_r($zoneInfo);
```

### Fetch your zone WSDL then setting your integration code

[](#fetch-your-zone-wsdl-then-setting-your-integration-code)

```
// This code is designed to find your exact wsdl location.
// If you already know your zone's wsdl URL, you can skip
// this step.
$username = 'admin@happymsp.biz';
$password = 'VeryVeryVeryVerySecurePassword';
$authWsdl = 'https://webservices.autotask.net/atservices/1.6/atws.wsdl';
$opts = array('trace' => 1);
$client = new ATWS\Client($authWsdl, $opts);
$integrationCode = '27-character ID';
$client->setIntegrationCode($integrationCode);
$zoneInfo = $client->getZoneInfo($username);

print_r($zoneInfo);
```

Version 1.5
-----------

[](#version-15)

Any Autotask user account with the 'Can login to Web Services API' permission can connect via this version of the API.

You can set your WSDL file or use the auto detect ()

### Fetch your zone WSDL

[](#fetch-your-zone-wsdl)

```
// This code is designed to find your exact wsdl location.
// If you already know your zone's wsdl URL, you can skip
// this step.
$username = 'admin@happymsp.biz';
$password = 'VeryVeryVeryVerySecurePassword';
$authWsdl = 'https://webservices.autotask.net/atservices/1.5/atws.wsdl';
$opts = array('trace' => 1);
$client = new ATWS\Client($authWsdl, $opts);
$zoneInfo = $client->getZoneInfo($username);

print_r($zoneInfo);
```

Resource Impersonation
----------------------

[](#resource-impersonation)

Your API-only user can impersonate resources on Account Notes, Contract Notes, Project Notes, Task Notes, Ticket Notes, and Time Entries. So, when notes and time entries are added to Autotask by users using an integration with Autotask, the user's name (not the API user's) appears as the author.

### Requirements

[](#requirements)

- Integration users need to provide the tag in the AutotaskIntegrations SOAP header.
- Both the integration user and the API-only user must have security level permission to add or edit the time entry.
- The integration user's security level must allow the resource to be impersonated.
- The API-only user's security level must allow impersonation on the entity type.

For more details on impersonation security levels, refer to [Resource Impersonation](https://ww5.autotask.net/help/Content/AdminSetup/1FeaturesSettings/ResourcesUsers/Security/System_Security_Settings.htm#Resource_Impersonation).

When calling the setResourceImpersonation() method. It will replace the existing SOAP header with the integration code and the resource to impersonation. Allowing you to change the resource impersonation without the need of instantiating a new client.

When the instantiating the client, if you did not include the integration code and you call the setResourceImpersonation() method, it would throw an error 'Integration code required when using resource impersonation.' To resolve, call method setIntegrationCode('27-character ID') to set the integration code then you can call setResourceImpersonation().

```
$authOpts = array(
    'login' => $username,
    'password' => $password,
    'trace' => 1,   // Allows us to debug by getting the XML requests sent
);
$integrationCode = '27-character ID';
$wsdl = str_replace('.asmx', '.wsdl', $zoneInfo->getZoneInfoResult->URL);
$client = new ATWS\Client($wsdl, $authOpts, $integrationCode);

// Instantiate an Account Note object and assign values
$accountNote = new ATWS\AutotaskObjects\AccountNote('Contact');
$accountNote->AccountID = 12345678;
$accountNote->ActionType = 1;
$accountNote->AssignedResourceID = 12345678;
$accountNote->EndDateTime = "2019-01-28T18:18:00";
$accountNote->id = 0;
$accountNote->Note = "Resource Impersonation Test";
$accountNote->StartDateTime = "2019-01-28T18:18:00";
$result = $client->setResourceImpersonation(87654321)->create($accountNote);

// Print the results of the account note creation
print_r($result);
```

Or you can call the setResourceImpersonation() method then call create() or update().

```
$authOpts = array(
    'login' => $username,
    'password' => $password,
    'trace' => 1,   // Allows us to debug by getting the XML requests sent
);
$integrationCode = '27-character ID';
$wsdl = str_replace('.asmx', '.wsdl', $zoneInfo->getZoneInfoResult->URL);
$client = new ATWS\Client($wsdl, $authOpts, $integrationCode);
$client->setResourceImpersonation(87654321);

// Instantiate an Account Note object and assign values
$accountNote = new ATWS\AutotaskObjects\AccountNote('Contact');
$accountNote->AccountID = 12345678;
$accountNote->ActionType = 1;
$accountNote->AssignedResourceID = 12345678;
$accountNote->EndDateTime = "2019-01-28T18:18:00";
$accountNote->id = 0;
$accountNote->Note = "Resource Impersonation Test";
$accountNote->StartDateTime = "2019-01-28T18:18:00";
$result = $client->create($accountNote);

// Print the results of the account note creation
print_r($result);
```

Search Contacts
---------------

[](#search-contacts)

```
$authOpts = array(
    'login' => $username,
    'password' => $password,
    'trace' => 1,   // Allows us to debug by getting the XML requests sent
);
$wsdl = str_replace('.asmx', '.wsdl', $zoneInfo->getZoneInfoResult->URL);
$client = new ATWS\Client($wsdl, $authOpts, $integrationCode);  // for version 1.6
// $client = new ATWS\Client($wsdl, $authOpts);   // for version 1.5 with no integration code

// Instantiate a Query object, designed to make complex
// queries simple.
$query = new ATWS\AutotaskObjects\Query('Contact');

$firstnameField = new ATWS\AutotaskObjects\QueryField('firstname');
$firstnameField->addExpression('Equals', 'Steve');

$query->addField($firstnameField);

// If you want to debug the XML produced by the Query object
// print($query->asXml());

// Print the results of the query
print_r($client->query($query));
```

More Detailed Queries
---------------------

[](#more-detailed-queries)

We have provided support for some of the more detailed queries that you may need to execute. A given query can have multiple `QueryField` objects and a given `QueryField` can have multple `QueryFieldExpression` objects.

```
$authOpts = array(
    'login' => $username,
    'password' => $password,
    'trace' => 1,   // Allows us to debug by getting the XML requests sent
);
$wsdl = str_replace('.asmx', '.wsdl', $zoneInfo->getZoneInfoResult->URL);
$client = new ATWS\Client($wsdl, $authOpts, $integrationCode);  // for version 1.6
// $client = new ATWS\Client($wsdl, $authOpts);   // for version 1.5 with no integration code

// Instantiate a Query object, designed to make complex
// queries simple.
$query = new ATWS\AutotaskObjects\Query('Contact');

// Add a QueryField with multiple expressions
$firstnameField = new ATWS\AutotaskObjects\QueryField('firstname');
// Multiple Expressions in a single Field results in a logical OR
$firstnameField->addExpression('BeginsWith', 'S');
$firstnameField->addExpression('Contains', 'e');

$query->addField($firstnameField);

$lastnameField = new ATWS\AutotaskObjects\QueryField('lastname');
$lastnameField->addExpression('BeginsWith', 'M');

// Add a second QueryField -- multiple Fields are ANDed together
$query->addField($lastnameField);

// print($query->asXml());
print_r($client->query($query));
```

*Really* Detailed Queries
-------------------------

[](#really-detailed-queries)

Need access to extremely detailed queries that involce using Conditions? Support for condition queries have been added to the autotask-php client. The important thing to note when using conditions is that order matters. Any `QueryCondition`or `QueryField` added will be serialized to XML in that order.

`QueryCondition` objects can include other `QueryCondition`objects, as well as `QueryField` objects. The example below attempts to showcase the possibilities of using a `QueryCondition` object.

```
$authOpts = array(
    'login' => $username,
    'password' => $password,
    'trace' => 1,   // Allows us to debug by getting the XML requests sent
);
$wsdl = str_replace('.asmx', '.wsdl', $zoneInfo->getZoneInfoResult->URL);
$client = new ATWS\Client($wsdl, $authOpts, $integrationCode);  // for version 1.6
// $client = new ATWS\Client($wsdl, $authOpts);   // for version 1.5 with no integration code

// Instantiate a Query object, designed to make complex
// queries simple.
$query = new ATWS\AutotaskObjects\Query('Contact');

// QueryConditions default to logical ANDs. If you want to
// using logcal OR, specify it when creating the QueryCondition
$wrappingCondition = new ATWS\AutotaskObjects\QueryCondition('OR');
$conditionOne = new \ATWS\AutotaskObjects\QueryCondition();
$conditionTwo = new \ATWS\AutotaskObjects\QueryCondition('OR');

$firstField = new ATWS\AutotaskObjects\QueryField('firstname');
$firstField->addExpression('Equals', 'Joe');

$secondField = new ATWS\AutotaskObjects\QueryField('firstname');
$secondField->addExpression('Equals', 'Larry');

$thirdField = new ATWS\AutotaskObjects\QueryField('lastname');
$thirdField->addExpression('Equals', 'Brown');

$fourthField = new ATWS\AutotaskObjects\QueryField('firstname');
$fourthField->addExpression('Equals', 'Mary');

$fifthField = new ATWS\AutotaskObjects\QueryField('lastname');
$fifthField->addExpression('Equals', 'Smith');

$sixthField = new ATWS\AutotaskObjects\QueryField('city');
$sixthField->addExpression('NotEqual', 'Albany');

// AND together the 2nd and 3rd fields into a condition
$conditionOne->addField($secondField);
$conditionOne->addField($thirdField);

// AND together the 4th and 5th fields into a condition
$conditionTwo->addField($fourthField);
$conditionTwo->addField($fifthField);

// OR together the 1st Condition and 2nd Condition
// NOTE: This is an OR because of how $conditionTwo
// was defined
$wrappingCondition->addCondition($conditionOne);
$wrappingCondition->addCondition($conditionTwo);

// Add the 1st Field to the Query
$query->addField($firstField);

// OR together the 1st Field and the wrapping Condition
// NOTE: This is an OR because of how $wrappingCondition
// was defined.
$query->addCondition($wrappingCondition);

// AND together the 6th Field and (1st Field OR wrapping Condition)
$query->addField($sixthField);

// If you want to debug the XML produced by the Query object
// print($query->asXml());

// Print the results of the query
print_r($client->query($query));
```

Since the above example is so complex, we have included the "SQL Equivalent" conditional, and the XML that is produced by the Client.

```
(
    firstname = 'Joe'
    OR (
        (firstname = 'Larry' AND lastname = 'Brown')
        OR
        (firstname = 'Mary' AND lastname = 'Smith')
    )
)
AND city  'Albany'
```

```

   Contact

         firstname
         Joe

               firstname
               Larry

               lastname
               Brown

               firstname
               Mary

               lastname
               Smith

         city
         Albany

```

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community25

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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.

###  Release Activity

Cadence

Every ~138 days

Recently: every ~258 days

Total

27

Last Release

756d ago

Major Versions

v0.3.4 → v1.0.02022-12-16

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.0

v1.0.1PHP &gt;=7.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/49e7b1b22aa6d40227fb11caf08b47a049c946ef68b091901bf36c7e971b0192?d=identicon)[tabacco](/maintainers/tabacco)

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

---

Top Contributors

[![reynolek](https://avatars.githubusercontent.com/u/5934780?v=4)](https://github.com/reynolek "reynolek (14 commits)")[![Egahras](https://avatars.githubusercontent.com/u/8733402?v=4)](https://github.com/Egahras "Egahras (5 commits)")[![devinhyden](https://avatars.githubusercontent.com/u/9685068?v=4)](https://github.com/devinhyden "devinhyden (5 commits)")[![rneufeldcisco](https://avatars.githubusercontent.com/u/86374474?v=4)](https://github.com/rneufeldcisco "rneufeldcisco (4 commits)")[![oliubarskyi](https://avatars.githubusercontent.com/u/8328847?v=4)](https://github.com/oliubarskyi "oliubarskyi (2 commits)")[![kmccormick](https://avatars.githubusercontent.com/u/1895045?v=4)](https://github.com/kmccormick "kmccormick (1 commits)")[![ryanchausse](https://avatars.githubusercontent.com/u/7827119?v=4)](https://github.com/ryanchausse "ryanchausse (1 commits)")[![srimanaravind](https://avatars.githubusercontent.com/u/4092725?v=4)](https://github.com/srimanaravind "srimanaravind (1 commits)")

---

Tags

soapautotaskmsppsa

### Embed Badge

![Health badge](/badges/opendns-autotask-php/health.svg)

```
[![Health](https://phpackages.com/badges/opendns-autotask-php/health.svg)](https://phpackages.com/packages/opendns-autotask-php)
```

###  Alternatives

[phpro/soap-client

A general purpose SoapClient library

8885.6M46](/packages/phpro-soap-client)[artisaninweb/laravel-soap

A SoapClient wrapper integration for Laravel

6314.5M12](/packages/artisaninweb-laravel-soap)[econea/nusoap

Fixed NuSOAP for PHP 5.6 - 8.5

3315.5M26](/packages/econea-nusoap)[wsdltophp/packagegenerator

Generate hierarchical PHP classes based on a WSDL

4351.9M19](/packages/wsdltophp-packagegenerator)[robrichards/wse-php

Libraries for adding WS-\* support to ext/soap in PHP.

1326.0M30](/packages/robrichards-wse-php)[laminas/laminas-soap

6221.8M37](/packages/laminas-laminas-soap)

PHPackages © 2026

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