PHPackages                             trisoftro/collective-access-client - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. trisoftro/collective-access-client

ActiveLibrary[HTTP &amp; Networking](/categories/http)

trisoftro/collective-access-client
==================================

Collective Access HTTP Client

0139PHP

Since Jun 13Pushed 2y ago2 watchersCompare

[ Source](https://github.com/trisoftro/ca-service-wrapper)[ Packagist](https://packagist.org/packages/trisoftro/collective-access-client)[ RSS](/packages/trisoftro-collective-access-client/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

A simple PHP wrapper for the new JSON-based REST web service API of CollectiveAccess

Please visit  for more information and refer to  for detailed information on the service API and other features of the core software.

To use this library, simply copy all the project files into a subdirectory of your project and include the class file of the service you want to use.

For example:

```
require './cawrapper/ItemService.php':
$client = new ItemService("http://localhost/","ca_objects","GET",1);
$result = $client->request();
print_r($result->getRawData());
```

This should get you a generic summary for the object record with object\_id 1.

Here are some more simple examples for the other service endpoints to get you started:

```
$vo_client = new ModelService("http://localhost/","ca_entities");
$vo_client->setRequestBody(array("types" => array("corporate_body")));
$vo_result = $vo_client->request();

$vo_result->isOk() ? print_r($vo_result->getRawData()) : print_r($vo_result->getErrors());
```

```
$vo_client = new SearchService("http://localhost/","ca_objects","*");
$vo_client->setRequestBody(array(
	"bundles" => array(
		"ca_objects.access" => array("convertCodesToDisplayText" => true),
		"ca_objects.status" => array("convertCodesToDisplayText" => true),
		"ca_entities.preferred_labels.displayname" => array("returnAsArray" => true)
	)
));
$vo_result = $vo_client->request();

$vo_result->isOk() ? print_r($vo_result->getRawData()) : print_r($vo_result->getErrors());
```

To use authentication, you basically have 3 options. The first is to use the PHP constants `__CA_SERVICE_API_USER__` and `__CA_SERVICE_API_KEY__` as shown in the next example, This comes in handy if you want to run multiple service requests in the same script.

Note that all 3 authentication options try to retrieve an authToken from the remote service, save it in a temporary directory and re-use it as long as it's valid. When it expires, it re-authenticates using the username and key provided using one of the 3 options below. user/key are not used in the mean time.

Now back to option one - the constants:

```
require './ca-service-wrapper/ItemService.php';

define('__CA_SERVICE_API_USER__', 'administrator');
define('__CA_SERVICE_API_KEY__', 'dublincore');

$o_service = new ItemService('http://localhost', 'ca_objects', 'GET', 1);
$o_result = $o_service->request();
```

You can also use a simple setter:

```
require './ca-service-wrapper/ItemService.php';

$o_service = new ItemService('http://localhost', 'ca_objects', 'GET', 1);
$o_service->setCredentials('administrator', 'dublincore');
$o_result = $o_service->request();
```

The 3rd option (and probably most suitable for production) is to pass the credentials as environment variables `CA_SERVICE_API_USER` and `CA_SERVICE_API_KEY`. Imagine this simple script as `authtest.php`

```
require './ca-service-wrapper/ItemService.php';

$o_service = new ItemService('http://localhost', 'ca_objects', 'GET', 1);
$o_result = $o_service->request();
```

Then running something like this in a terminal should work:

```
export CA_SERVICE_API_USER=administrator
export CA_SERVICE_API_KEY=dublincore
php authtest.php
```

To do this in a web server setting, you could look into [apache's mod\_env](http://httpd.apache.org/docs/2.4/mod/mod_env.html).

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% of commits — single point of failure

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e36edaf6bcfbf80c9630c62a539bb784e6f338c367479d7b54948e4d4140fad?d=identicon)[radutopala](/maintainers/radutopala)

---

Top Contributors

[![radutopala](https://avatars.githubusercontent.com/u/647137?v=4)](https://github.com/radutopala "radutopala (9 commits)")[![bogdannitu](https://avatars.githubusercontent.com/u/1462860?v=4)](https://github.com/bogdannitu "bogdannitu (5 commits)")[![alexandruMiron](https://avatars.githubusercontent.com/u/65958044?v=4)](https://github.com/alexandruMiron "alexandruMiron (1 commits)")

---

Tags

collective-accesscollectiveaccesshttp-clientphp

### Embed Badge

![Health badge](/badges/trisoftro-collective-access-client/health.svg)

```
[![Health](https://phpackages.com/badges/trisoftro-collective-access-client/health.svg)](https://phpackages.com/packages/trisoftro-collective-access-client)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)

PHPackages © 2026

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