thigas88/alfresco-api-php-client

dev-master 2024-02-14 16:58 UTC

This package is auto-updated.

Last update: 2024-09-14 18:20:49 UTC


README

This project is a fork from rhuanbarreto/alfresco-api-php-client with some improvements

API Provides access to the features of Alfresco Content Services.

Requirements

PHP 5.4.0 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "require": {
    "thigas88/alfresco-api-php-client": "@dev"
  }
}

Then run composer install

Or run composer require thigas88/alfresco-api-php-client

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/AlfrescoAPI/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started - Core API

Please follow the installation procedure and then run the following for using the CORE API:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure HTTP basic authorization: basicAuth
Alfresco\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Alfresco\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');
Alfresco\Configuration::getDefaultConfiguration()->setHost('http://[YOUR_ALFRESCO_HOSTNAME]:[YOUR_ALFRESCO_PORT]/alfresco/api/-default-/public/alfresco/versions/1');

$api_instance = new Alfresco\Api\ActivitiesApi();
$person_id = "person_id_example"; // string | The identifier of a person.
$skip_count = 0; // int | The number of entities that exist in the collection before those included in this list.  If not supplied then the default value is 0.
$max_items = 100; // int | The maximum number of items to return in the list.  If not supplied then the default value is 100.
$who = "who_example"; // string | A filter to include the user's activities only `me`, other user's activities only `others`'
$site_id = "site_id_example"; // string | Include only activity feed entries relating to this site.
$fields = array("fields_example"); // string[] | A list of field names.  You can use this parameter to restrict the fields returned within a response if, for example, you want to save on overall bandwidth.  The list applies to a returned individual entity or entries within a collection.  If the API method also supports the **include** parameter, then the fields specified in the **include** parameter are returned in addition to those specified in the **fields** parameter.

try {
    $result = $api_instance->listActivitiesForPerson($person_id, $skip_count, $max_items, $who, $site_id, $fields);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ActivitiesApi->listActivitiesForPerson: ', $e->getMessage(), PHP_EOL;
}

?>

Getting Started - Search API

Please follow the installation procedure and then run the following for using the Search API:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Configure HTTP basic authorization: basicAuth
Alfresco\Configuration::getDefaultConfiguration()->setUsername('YOUR_USERNAME');
Alfresco\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD');
Alfresco\Configuration::getDefaultConfiguration()->setHost('http://[YOUR_ALFRESCO_HOSTNAME]:[YOUR_ALFRESCO_PORT]/alfresco/api/-default-/public/search/versions/1');

$api_instance = new Alfresco\Api\SearchApi();
$query_body = new \Alfresco\Model\SearchRequest(); // \Alfresco\Model\SearchRequest | Generic query API
$query_body->setQuery(["query" => "foo"]);

try {
    $result = $api_instance->search($query_body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling SearchApi->search: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All CORE API URIs are relative to https://localhost/alfresco/api/-default-/public/alfresco/versions/1

All Search API URIs are relative to https://localhost/alfresco/api/-default-/public/search/versions/1

Documentation For Models

Documentation For Authorization

basicAuth

  • Type: HTTP basic authentication

Author

Rhuan Barreto - rhuan@rhuan.com.br