thigas88/alfresco-api-php-client

用于Alfresco API的PHP库

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

This package is auto-updated.

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


README

该项目是从rhuanbarreto/alfresco-api-php-client分支出来,并进行了一些改进。

API 提供对Alfresco内容服务功能的访问。

要求

PHP 5.4.0及以后版本

安装与使用

Composer

要通过Composer安装绑定,请将以下内容添加到composer.json

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

然后运行composer install

或者运行composer require thigas88/alfresco-api-php-client

手动安装

下载文件并包含autoload.php

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

测试

要运行单元测试

composer install
./vendor/bin/phpunit

入门 - 核心API

请遵循安装过程,然后运行以下命令使用核心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;
}

?>

入门 - 搜索API

请遵循安装过程,然后运行以下命令使用搜索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;
}

?>

API端点文档

所有核心API URI相对于https:///alfresco/api/-default-/public/alfresco/versions/1

所有搜索API URI相对于https:///alfresco/api/-default-/public/search/versions/1

模型文档

授权文档

基本认证

  • 类型:HTTP基本认证

作者

Rhuan Barreto - rhuan@rhuan.com.br