PHPackages                             dialogue1/amity-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. [API Development](/categories/api)
4. /
5. dialogue1/amity-client

ActiveLibrary[API Development](/categories/api)

dialogue1/amity-client
======================

API client for amity

0251[1 PRs](https://github.com/dialogue1/amity-client/pulls)PHP

Since Dec 4Pushed 8y ago2 watchersCompare

[ Source](https://github.com/dialogue1/amity-client)[ Packagist](https://packagist.org/packages/dialogue1/amity-client)[ RSS](/packages/dialogue1-amity-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

amity API Client
================

[](#amity-api-client)

This package contains a Guzzle3-based API client for the amity API (v2). Use this if you want to connect your project with an amity installation and manage contacts, lists etc.

Requirements
------------

[](#requirements)

- PHP 5.3
- Composer to install the package and its dependencies

Installation
------------

[](#installation)

Using Composer, installing is as simple as doing

```
php composer.phar require dialogue1/amity-client:~1.0

```

In your PHP code, all you need is to include the autoloader generated by Composer:

```
require 'vendor/autoload.php';

$apiClient = dialogue1\amity\API\Client::create(...);
```

Usage
-----

[](#usage)

In general, you need four pieces of information to use the amity API:

- the hostname of the installation (e.g. `news.mydomain.com`)
- whether or not to use SSL
- the amity client ID (e.g. `gh26bb81`)
- your amity API key (e.g. `34hguj13fggj1kjh24j5hg45j1h3g2g42`)

You can either instantiate a fresh API client, which sets up all the dependencies as you need it, or use a plain Guzzle object and inject the amity API logic into it.

### Using the API client

[](#using-the-api-client)

```
// This will setup a new Guzzle client and prepare it for the amity API
$apiClient = dialogue1\amity\API\Client::create(
   'news.mydomain.com',
   true,
   'gh26bb81',
   '34hguj13fggj1kjh24j5hg45j1h3g2g42'
);
```

The API client offers wrappers around the provided API endpoints and takes care of handling errors for you. The code to handle the resources like contacts is available in *services*.

```
$apiClient      = dialogue1\amity\API\Client::create(...);
$contactService = $apiClient->getContactService();

// both $contacts and $females will be a PHP array of contacts
$contacts = $contactService->getMany();
$females  = $contactService->getMany(null, null, null, null, 'f');

$newbie = $contactService->create(array(
	'email' => 'some@one.org'
));
```

If the existing wrappers are not sufficient (e.g. if you want to use resource embedding), you can use the `requestData()` helper method.

```
$apiClient = dialogue1\amity\API\Client::create(...);
$contacts  = $apiClient->requestData('GET', '/contacts', array('embed' => 'lists'));
```

### Using an existing Guzzle HTTP client

[](#using-an-existing-guzzle-http-client)

Alternatively, just use the `RequestSigner` plugin to add the signing functionality to any Guzzle instance - in this case, you need to take care of setting the hostname and SSL yourself:

```
$httpClient = getGuzzleClientFromMyExistingFramework();
$signer     = new dialogue1\amity\API\RequestSigner('', '');

$httpClient->addSubscriber($signer);
```

With this setup, you can perform freeform requests as you see fit. Note that you have to take care of decoding JSON, handlings errors etc. yourself!

```
// [snip]

$contacts = $httpClient->get('/contacts');
```

License
-------

[](#license)

This code is licensed under the MIT license.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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/7c14b14150274a0a1346d98505e03660ad8afa4be3edb1a3304da84a2e7e87f9?d=identicon)[dialogue1](/maintainers/dialogue1)

### Embed Badge

![Health badge](/badges/dialogue1-amity-client/health.svg)

```
[![Health](https://phpackages.com/badges/dialogue1-amity-client/health.svg)](https://phpackages.com/packages/dialogue1-amity-client)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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