PHPackages                             thiagormoreira/awsfacematch - 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. thiagormoreira/awsfacematch

ActiveLibrary

thiagormoreira/awsfacematch
===========================

AWS face match package for Laravel

v0.92(2y ago)05MITPHPPHP ^8.0

Since Oct 6Pushed 2y agoCompare

[ Source](https://github.com/thiagormoreira/AwsFaceMatch)[ Packagist](https://packagist.org/packages/thiagormoreira/awsfacematch)[ Docs](https://github.com/grananda/AwsFaceMatch)[ RSS](/packages/thiagormoreira-awsfacematch/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (9)Versions (27)Used By (0)

AWS Laravel Face Match (BETA)
=============================

[](#aws-laravel-face-match--beta)

This component integrates face recognition to conventional Laravel models such as users with avatar images. This package compares a single face image against an indexed collection of images and returns a matching model with an accuracy score greater than 80%.

This component uses the [AWS Rekogniton](https://aws.amazon.com/es/rekognition/) engine. Please review the site for credentials setup and prices.

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

[](#installation)

To install through composer, simply execute the following command :

```
composer require grananda/AwsFaceMatch
```

Execute the following command to copy the configuration file to your application config folder:

```
php artisan vendor:publish --provider="Grananda\AwsFaceMatch\FaceMatchServiceProvider"
```

Add your AWS `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` credentials to your `.env` file.

For the component to work, you need a set of AWS key and secret as well as the zone where you wish to operate. This values will be read from you `.env` file as usual. Other configuration parameters will be included in the `facematch.php` config file.

Please remember that for older versions on Laravel &lt;5.5, it is necessary to register the component service provider in your `config/app.php` file under the `$providers` array element.

```
Grananda\AwsFaceMatch\FaceMatchServiceProvider::class,
```

Also, in the `$aliases` array element, add the following available facades for this package. This is only necessary if you wish to access the package services method outside the trait scope.

```
'FaceMatch' => Grananda\AwsFaceMatch\Facades\FaceMatch::class,
'FaceCollection' => Grananda\AwsFaceMatch\Facades\FaceCollection::class,
```

Finally, run thepackage migrations that will create tables where indexed information will be stored.

```
php artisan migrate
```

Setup your Eloquent models
--------------------------

[](#setup-your-eloquent-models)

Laravel Face Match can recognize people from different models. For example, if you have models for clients and employees, you can request an image match against any of those models.

To start using this package, you must have the model(s) registered in the face match configuration file as displayed below:

```
'recognize' => [
    Employee::class => [
        'collection' => 'entity',
        'identifier' => 'uuid,',
        'media' => [
	        'field'  => 'avatar_image',
	        'binary' => false,
	    ],
    ],
],
```

Where every element of the `recognize` array element correspond to an existing model class. Each element key must match the model class name. Additionally, the elements must be completed as followed per each of the used models:

- **Collection**: wherein AWS will the avatar images and user references be indexed. If none, a combination of the model `namespace` and `className` will be used as the default collection name.
- **Identifier**: which unique field in the model database will be used to identify the record once a face match occurs. It is recommended to use a **UUID** field for such a purpose.
- **Field**: determines which field in the model database will the face image URL be stored.
- **Binary**: defines if the field that stores the image information is a binary or blob field. Default is `false`.

To make a model suitable for face recognition, you must add the `FacialRecognition` trait to your models as illustrated below.

```
namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Grananda\AwsFaceMatch\Traits\FacialRecognition;

 class Employee extends Model {

     use FacialRecognition;

     protected $fillable = [
        'name',
        'uuid',
        'avatar_image',
    ];
}
```

In addition, both the `field` and `identifier` fields should be included in the model `fillable` array as well as in your database migrations if necessary.

You can add the face match functionality to as many models as you wish as far as they do not share the same collection.

No AWS S3 Bucket it needed but could be used for storing your model images. All that is needed is an image URL or a binary database record with the image data.

The system only accepts **single face images** when indexing an entity for future recognition.

How to Use it
-------------

[](#how-to-use-it)

When a model using the `FacialRecognition` trait creates a new object, the avatar image is stored in the AWS Rekognition services along with the record identifier. The same occurs when the record is updated with a **different** image URL. No Rekognition index action will take place if the record lacks a media URL or data when saving the item.

Wiselike, all stored indexed information is removed from the AWS when a model is locally removed.

### Identifying models from an image

[](#identifying-models-from-an-image)

Use the following command If you wish to find a model that may match a specif image:

```
Employee::faceMatch('path/or/url/to/image.png');
```

Where `Employee` can be replaced by any other model using the face match feature. If there is a match, the command will return the model object corresponding to the given image or `false` otherwise.

Although the system can index images from binary database fields, the match or recognition process must use a file system based stored image path to function. Pure binary comparison is not yet supported. Please help us improve this component by providing a valid use case for this scenario.

### Forgetting an Image

[](#forgetting-an-image)

Use the following comand to remove a local record from the remote AWS Rekognition system. This feature can be useful when a user requests to be removed from the face recognition system.

```
Employee::faceForget($object);
```

### Cleaning up

[](#cleaning-up)

The following command will remove all images from a model collection. Please use it wisely.

```
Employee::purgeCollection();
```

### Mass Indexing

[](#mass-indexing)

To indexing already existing data, run the following command from the console:

```
php artisan facematch:index
```

Comming Soon
------------

[](#comming-soon)

- Manually specify the accuracy threshold when detecting matches.

Please feel free to comment and make requests.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 98.9% 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 ~80 days

Recently: every ~353 days

Total

20

Last Release

877d ago

PHP version history (2 changes)v0.5PHP ^7.2

v0.92PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/d8e12d3a8e44f1f0ef8c1b6ad8e6750198f9ca12ed660d0a290920d72b2f9f4c?d=identicon)[thiagormoreira](/maintainers/thiagormoreira)

---

Top Contributors

[![grananda](https://avatars.githubusercontent.com/u/390559?v=4)](https://github.com/grananda "grananda (89 commits)")[![thiagormoreira](https://avatars.githubusercontent.com/u/246995?v=4)](https://github.com/thiagormoreira "thiagormoreira (1 commits)")

---

Tags

phpawsMatchfacerekognition

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thiagormoreira-awsfacematch/health.svg)

```
[![Health](https://phpackages.com/badges/thiagormoreira-awsfacematch/health.svg)](https://phpackages.com/packages/thiagormoreira-awsfacematch)
```

###  Alternatives

[dusterio/laravel-aws-worker

Run Laravel (or Lumen) tasks and queue listeners inside of AWS Elastic Beanstalk workers

3105.7M](/packages/dusterio-laravel-aws-worker)[eddturtle/direct-upload

Composer Package to build an AWS Signature ready to Direct Upload to S3

88728.1k2](/packages/eddturtle-direct-upload)

PHPackages © 2026

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