Download the PHP package anteris-dev/autotask-client without Composer

On this page you can find all versions of the php package anteris-dev/autotask-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package autotask-client

About this Package

Test

This package provides a PHP API client for the Autotask REST API. It is strongly typed and it is a wonderful experience to work with these classes in any intelligent IDE with autocompletion.

To Install

Run composer require anteris-dev/autotask-client

Requirements

Discord

Join the Anteris-Dev Discord to keep up with other users of this package!

Table of Contents

Getting Started

Client Wrapper

For the purpose of ease, there is a client wrapper that allows you to easily interact with every Autotask service. This can be created as shown below.

From here, you can use any service by referencing its class method as shown below. The class wrapper caches each instantiation of the service making it efficient.

To find the base URL for your company, go to https://webservices.autotask.net/atservicesrest/v1.0/zoneInformation?user={{ apiUser }} where {{ apiUser }} equals the username of your API user.

Bypassing the Client Wrapper

If you are only interacting with one or two Autotask endpoints, you may wish to bypass the client wrapper. You can do this as shown below.

Interacting with an Endpoint

There are several methods that exist on each service that help you interact with the endpoint. These are listed below. CRUD operations will throw an exception if there are any problems performing the request.

If an endpoint does not support a certain action (e.g. creating resources) the class will not have the method present. To see if an endpoint supports a method, check out the Autotask API documentation. We left a link in the resources section.

create( $resource )

Endpoints that allow creation of new items have a create() method. This takes an entity. An example of its use may be found below.

deleteById( int $id )

Endpoints that allow deletion of items have a deleteById() method. This takes an integer which should be the ID of the asset in Autotask. An example of its use may be found below.

findById( int $id )

Endpoints that can be queried have a findById() method. This takes an integer which should be the ID of the asset in Autotask. An example of its use may be found below.

getEntityFields()

All endpoints can have basic metadata queried. This method returns a specification of what fields the resource has and what their data types are. For more information we recommend taking a look at the Autotask documentation.

getEntityInformation()

All endpoints can have basic metadata queried. This method returns a specification of what actions the resource has available (create, update, delete, etc.). For more information we recommend taking a look at the Autotask documentation.

getEntityUserDefinedFields()

All endpoints can have basic metadata queried. If the resource supports User Defined Fields, this method returns a specification of what user defined fields the resource has and their data types. For more information we recommend taking a look at the Autotask documentation.

query()

Endpoints that can be queried have a query() method. This returns a query builder that has several options. These and examples of its use may be found below.

where()

This method adds a where filter to the query. You may pass a comparison to it or a callback to create a sub-query. Multiple where statements may be chained. For example:

Full options for the where() method are as shown below:

where( $field, $operator = null, $value = null, $udf = false, $conjuction = 'AND' )

orWhere()

This method acts as the where() method above, but uses an OR conjunction. Example below.

Full options for the orWhere() method are shown below:

orWhere( $field, $operator = null, $value = null, $udf = false )

The method returns the following call:

$this->where($field, $operator, $value, $udf, 'OR');

records( int $records )

This method limits the number of records that Autotask returns. The integer passed must be between 1 and 500. Example below.

count()

Once you have defined all your filters, you may run this method to see how many records making the request would return. This may be helpful for planning out pagination, etc. Example below.

get()

Once you have defined all your filters, you may run this method to make the request against the Autotask API and return a collection of items containing the result. Example below.

paginate()

The get() method is great, but what if I have over 500 results? What if I want to page the results? We have you covered! Use the paginate() method to return a Paginator object with helper properties and methods. These are explained below.

collection

When using a paginator object, you reference the collection with this property.

hasNextPage()

This returns true if a next page exists. If it does not, it returns false.

hasPrevPage()

This returns true if a previous page exists. If it does not, it returns false.

nextPage()

This attempts to retrieve the next page and returns it.

prevPage()

This attempts to retrieve the previous page and returns it.

Let's take a look at an example of these helper methods in action.

loop()

Instead of iterating over all the records in Autotask via the paginate() method, you can very easily do this with the loop method. This method takes a callback function which will be executed for every record in Autotask that meets the criteria.

Example:

update( $resource )

Endpoints that allow updating of items have an update() method. This takes an entity. An example of its use may be found below.

Resources


All versions of autotask-client with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 | ^8.0 | ^8.1
ext-json Version *
guzzlehttp/guzzle Version ^6.3|^7.0
illuminate/collections Version ^8.0 | ^9.0 | ^10.0
nesbot/carbon Version ^2.0
spatie/data-transfer-object Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package anteris-dev/autotask-client contains the following files

Loading the files please wait ....