PHPackages                             subsan/microsoft-cognitive-face-php-api-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. subsan/microsoft-cognitive-face-php-api-client

ActiveLibrary[API Development](/categories/api)

subsan/microsoft-cognitive-face-php-api-client
==============================================

PHP client for Face module in Microsoft Cognitive Services

v1.0.1(7y ago)0236Apache-2.0PHPPHP &gt;=7.1

Since Aug 31Pushed 7y ago1 watchersCompare

[ Source](https://github.com/subsan/microsoft-cognitive-face-php-api-client)[ Packagist](https://packagist.org/packages/subsan/microsoft-cognitive-face-php-api-client)[ Docs](https://github.com/subsan/microsoft-cognitive-face-php-api-client)[ RSS](/packages/subsan-microsoft-cognitive-face-php-api-client/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

Microsoft Cognitive Face Service APIs Client Library for PHP
============================================================

[](#microsoft-cognitive-face-service-apis-client-library-for-php)

The cloud-based Face API provides developers with access to advanced face algorithms. Microsoft Face algorithms enable face attribute detection and face recognition

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

[](#requirements)

- [PHP 7.1.0 or higher](http://www.php.net/)

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

[](#installation)

You can use **Composer** or simply **Download the Release**

### Composer

[](#composer)

The preferred method is via [composer](https://getcomposer.org). Follow the [installation instructions](https://getcomposer.org/doc/00-intro.md) if you do not already have composer installed.

Once composer is installed, execute the following command in your project root to install this library:

```
composer require subsan/microsoft-cognitive-face-php-api-client
```

Finally, be sure to include the autoloader:

```
require_once '/path/to/your-project/vendor/autoload.php';
```

### Download the Release

[](#download-the-release)

If you abhor using composer, you can download the package in its entirety. The [Releases](https://github.com/subsan/microsoft-cognitive-face-php-api-client/releases) page lists all stable versions. Download any file with the name `microsoft-cognitive-face-php-api-client-[RELEASE_NAME].zip` for a package including this library and its dependencies.

Uncompress the zip file you download, and include the autoloader in your project:

```
require_once '/path/to/microsoft-cognitive-face-php-api-client/vendor/autoload.php';
```

Examples
--------

[](#examples)

### Basic Example

[](#basic-example)

```
// include your composer dependencies
require_once 'vendor/autoload.php';

$client = new \Subsan\MicrosoftCognitiveFace\Client('YOUR_APP_KEY', 'YOUR_REGION');
$faces  = $client->face()->detectFacesFromImg('URL_IMAGE_WITH_FACES');

var_dump($faces);
```

### Create person group and add new persons for all faces in image

[](#create-person-group-and-add-new-persons-for-all-faces-in-image)

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

$client = new \Subsan\MicrosoftCognitiveFace\Client('YOUR_APP_KEY', 'YOUR_REGION');

// create new person group
$newPersonGroupId = uniqid();
$client->personGroup($newPersonGroupId)->create(
    new \Subsan\MicrosoftCognitiveFace\Entity\PersonGroup(
        null,
        'Group Name',
        'Additional info'
    )
);

// get faces from image
$url   = 'URL_IMAGE_WITH_FACES';
$faces = $client->face()->detectFacesFromImg($url);

$userNumber = 1;
foreach ($faces as $face) {
    $personFaceRectangle = (new \Subsan\MicrosoftCognitiveFace\Entity\FaceRectangle())->import($face->faceRectangle);

    // create person
    $person = $client->personGroup($newPersonGroupId)->person()->create(
        new \Subsan\MicrosoftCognitiveFace\Entity\Person(
            null,
            'User '.$userNumber
        )
    );

    // add image to person
    $client->personGroup($newPersonGroupId)->person($person->getPersonId())->addFace($url,'test',$personFaceRectangle);

    $userNumber++;
}
```

### Training person group

[](#training-person-group)

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

$client = new \Subsan\MicrosoftCognitiveFace\Client('YOUR_APP_KEY', 'YOUR_REGION');

// in previous example $newPersonGroupId
$personGroupId = 'ID_OF_CREATED_PERSON_GROUP';

// train group
$client->personGroup()->train($personGroupId);

// get train status
var_dump($client->personGroup()->getTrainStatus($personGroupId));
```

### Identity all faces in image

[](#identity-all-faces-in-image)

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

$client = new \Subsan\MicrosoftCognitiveFace\Client('YOUR_APP_KEY', 'YOUR_REGION');

// in previous example $newPersonGroupId
$personGroupId = 'ID_OF_CREATED_PERSON_GROUP';

// get faces from image
$url   = 'URL_IMAGE_WITH_FACES';
$faces = $client->face()->detectFacesFromImg($url);

// prepare array of faces ids
$faceIds = array();
foreach ($faces as $face) {
    $faceIds[] = $face->faceId;
}

// identify all faces
print_r($client->face()->identify($faceIds, $personGroupId));
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2816d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/53d729d80652951dfdf1c55d73a38d866b529b20855fdc061e9ed0e0397a26d1?d=identicon)[subsan](/maintainers/subsan)

---

Top Contributors

[![subsan](https://avatars.githubusercontent.com/u/1093589?v=4)](https://github.com/subsan "subsan (4 commits)")

---

Tags

apimicrosoftfacecognitive

### Embed Badge

![Health badge](/badges/subsan-microsoft-cognitive-face-php-api-client/health.svg)

```
[![Health](https://phpackages.com/badges/subsan-microsoft-cognitive-face-php-api-client/health.svg)](https://phpackages.com/packages/subsan-microsoft-cognitive-face-php-api-client)
```

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[jordikroon/google-vision

Google Vision Api for PHP (https://cloud.google.com/vision/)

6374.9k1](/packages/jordikroon-google-vision)[get-stream/stream-chat

A PHP client for Stream Chat (https://getstream.io/chat/)

301.8M2](/packages/get-stream-stream-chat)[convertkit/convertkitapi

Kit PHP SDK for the Kit API

2167.1k1](/packages/convertkit-convertkitapi)

PHPackages © 2026

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