Download the PHP package xsolve-pl/face-validator-bundle without Composer
On this page you can find all versions of the php package xsolve-pl/face-validator-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download xsolve-pl/face-validator-bundle
More information about xsolve-pl/face-validator-bundle
Files in xsolve-pl/face-validator-bundle
Package face-validator-bundle
Short Description Symfony3 bundle for validating face on picture using MS Azure Face API
License MIT
Homepage https://xsolve.software
Informations about the package face-validator-bundle
XSolve Face Validator Bundle
============================
Table of contents
- Introduction
- License
- Getting started
- Usage
Introduction
This Symfony3 bundle allows to validate whether an image (for instance uploaded by a user of your app) contains person's face. Internally it uses MS Azure Face API so in order to use it you need an account in MS Azure. In free plan the API allows to make 30 000 requests per month and 20 per minute so it should be enough to be useful for low traffic apps.
All the following features are configurable on the constraint level and can be easily enabled/disabled:
- requiring certain face size (ratio to the image size)
- disallowing an image when the face is covered
- requiring the hair to be visible (the image must not be cut)
- allowing the face to be rotated in any of the 3 axes to given level
- disallowing to wear glasses
- disallowing to wear sunglasses
- disallowing any makeup
- requiring an image not to be blurred over given level (low/medium/high)
- requiring an image not to contain noises over given level (low/medium/high)
Licence
This library is under the MIT license. See the complete license in LICENSE file.
Getting started
Add the bundle to your Symfony3 project using Composer:
You'll need also to register the bundle in your kernel:
In the configuration file you must provide your MS Azure subscription key for Face API
and the region name (can be taken from the Endpoint
section in MS Azure portal). Available regions can be previewed by running:
Example configuration:
Usage
Check this documentation if you'd like to know how to allow users to upload files using Symfony forms and validation. Assuming in your application you already have some model representing a user (for instance Doctrine entity) and it's used in a form to gather the data from users and perform validation, it already contains a profile picture:
or with YML:
For other validation config formats please check dedicated documentation section
Now when executing regular validation, for instance in your controller:
the image will be validated whether it contains a face. The way the face is being validated is customizable, all the possible options with their default values are shown on the example below:
Note that you can omit any (or even all) of the options listed above, then the defaults will be used.
For blur and noise levels the possible options are:
- low
- medium
- high
It's also possible, just like with any other Symfony validator, to use it directly against given value (either file path or an instance of \SplFileInfo).
All versions of face-validator-bundle with dependencies
guzzlehttp/guzzle Version ~6.3
myclabs/php-enum Version ~1.5
symfony/http-kernel Version 3.3.*
symfony/config Version 3.3.*
symfony/dependency-injection Version 3.3.*
symfony/validator Version 3.3.*
symfony/property-access Version 3.3.*