Client SDKs

PHP Automation Client

Updated: February 27, 2017 Page Information Edit on GitHub

The Nuxeo Automation PHP Client is a PHP client library for Nuxeo Automation API.

It is compatible with Nuxeo Platform LTS 2015, LTS 2016 and latest Fast Tracks.

Path to the PHP Client (v1.5)

Version 1.5.0 introduces a new fluent API. The old API is still available. Thus you can upgrade the library to the 1.5 version and access the new API and features without breaking your application.

version < 1.5.0

$client = new \Nuxeo\Automation\Client\NuxeoPhpAutomationClient('http://localhost:8080/nuxeo/site/automation');
$session = $client->getSession('Administrator', 'Administrator');
$answer = $session->newRequest("Document.Query")->set('params', 'query', "SELECT * FROM Document)->setSchema($propertiesSchema)->sendRequest();
$documentsArray = $answer->getDocumentList();

version >= 1.5.0

$client = new \Nuxeo\Client\Api\NuxeoClient('http://localhost:8080/nuxeo', 'Administrator', 'Administrator');
$documents = $client->schemas("*")->automation('Document.Query')->param('query', 'SELECT * FROM Document')->execute(Documents::className);

Getting Started

Library import

Download the latest stable release Nuxeo Automation PHP Client 1.5.0.


  "require": {
    "nuxeo/nuxeo-automation-php-client": "~1.5.0"


Creating a Client

The following documentation and samples applies for the 1.5 and newer versions. Calls to the Automation API for previous versions of the client will require adjustments.

For a given url:

$url = 'http://localhost:8080/nuxeo';

And given credentials:

use Nuxeo\Client\Api\NuxeoClient;

$client = new NuxeoClient($url, 'Administrator', 'Administrator');


// For defining all schemas
$client = $client->schemas("*");
// For changing authentication method

use Nuxeo\Client\Api\Auth\PortalSSOAuthentication;
use Nuxeo\Client\Api\Auth\TokenAuthentication;

// PortalSSOAuthentication with nuxeo-platform-login-portal-sso
$client = $client->setAuthenticationMethod(new PortalSSOAuthentication($secret, $username));

// TokenAuthentication
$client = $client->setAuthenticationMethod(new TokenAuthentication($token));


Automation API

To use the Automation API, Nuxeo\Client\Api\NuxeoClient#automation() is the entry point for all calls:

use Nuxeo\Client\Api\Objects\Document;

// Fetch the root document
$result = $client->automation('Repository.GetDocument')->param("value", "/")->execute(Document::className);
use Nuxeo\Client\Api\Objects\Documents;

// Execute query
$operation = $client->automation('Repository.Query')->param('query', 'SELECT * FROM Document');
$result = $operation->execute(Documents::className);
use Nuxeo\Client\Api\Objects\Blob\Blob;
use Nuxeo\Client\Api\Objects\Blob\Blobs;

// To upload|download blob(s)

$fileBlob = Blob::fromFile('/local/file.txt', 'text/plain');
$blob = $client->automation('Blob.AttachOnDocument')->param('document', '/folder/file')->input($fileBlob)->execute(Blob::className);

$inputBlobs = new Blobs();
$inputBlobs->add('/local/file1.txt', 'text/plain');
$inputBlobs->add('/local/file2.txt', 'text/plain');
$blobs = $client->automation('Blob.AttachOnDocument')->param('xpath', 'files:files')->param('document', '/folder/file')->input($inputBlobs)->execute(Blobs::className);

$resultBlob = $client->automation('Document.GetBlob')->input('folder/file')->execute(Blob::className);


The main exception type is Nuxeo\Client\Internals\Spi\NuxeoClientException and contains:

  • The HTTP error status code (666 for internal errors)
  • An info message
5 months ago Solen Guitter Formatting
5 months ago Pierre-Gildas MILLON Add compatibility note + fix duplicate usage
5 months ago GitHub Add some missing authentication methods
5 months ago GitHub Update PHP Client doc with release 1.5.0
6 months ago Pierre-Gildas MILLON PHP Client doc fixes
8 months ago GitHub Update link to the 1.1.1 version of the PHP Client
8 months ago GitHub change label to 'lts2016-ok'
8 months ago Pierre-Gildas MILLON NXDOC-980: update the PHP client page
8 months ago Andrew Goodricke Add content-review-lts2016 to labels
8 months ago Kevin Leturc NXP-19481: Update MarkLogic page to detail how to configure range element indexes
2 years ago Vincent Dutat 17
2 years ago Manon Lumeau 16
2 years ago Frédéric Vadon 15 | The name of the client changed because of
4 years ago Solen Guitter 14
4 years ago Solen Guitter 13 | Added TOC and excerpt
5 years ago Solen Guitter 11 | Fixed file:content interpreted as a link
5 years ago Solen Guitter 12 | Migrated to Confluence 4.0
6 years ago Arthur Gallouin 10
6 years ago Arthur Gallouin 9
6 years ago Arthur Gallouin 8
6 years ago Alain Escaffre 7
6 years ago Arthur Gallouin 6
6 years ago Arthur Gallouin 5
6 years ago Arthur Gallouin 4
6 years ago Arthur Gallouin 3
6 years ago Arthur Gallouin 2
6 years ago Arthur Gallouin 1
History: Created by Arthur Gallouin