Download the PHP package mailmug/php_dlib without Composer
On this page you can find all versions of the php package mailmug/php_dlib. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mailmug/php_dlib
More information about mailmug/php_dlib
Files in mailmug/php_dlib
Package php_dlib
Short Description PHP extension for the Dlib C++ library (face detection, landmarks, recognition, and clustering).
License MIT
Informations about the package php_dlib
PHP-Dlib
PHP extension for the Dlib C++ library (face detection, landmarks, recognition, and clustering).
This project is a fork of the original pdlib and extends it with improved build support and modern Dlib versions.
🚀 Features
- ✅ Face Detection (HOG / CNN)
- ✅ Facial Landmark Detection
- ✅ Face Recognition (128D descriptors)
- ✅ Deep Learning-based face detection (CNN)
- ✅ Chinese Whispers clustering (graph-based grouping)
PHP Dlib Extension Quick Installation Guide
1. Download the Extension
Download the correct file from: Releases
Choose:
- Windows →
.dll - Linux →
.so - Mac →
.so
Make sure it matches:
- PHP version (8.2 / 8.3 / 8.5)
- Thread Safe (TS) or Non-Thread Safe (NTS)
- Architecture (x64 / x86)
2. Windows Installation (.dll)
Find php.ini
Create file:
Open: http://localhost/info.php Then check: Loaded Configuration File (php.ini).
Finally, add the following code to the php.ini file
Then restart the server. Finished :)
Requirements
- Dlib 20+
- C++14
- libx11-dev (on Ubuntu:
sudo apt-get install libx11-dev)
Recommended
- BLAS library
If no BLAS library found - dlib's built-in BLAS will be used. However, if you install an optimized BLAS such as OpenBLAS or the Intel MKL your code will run faster. On Ubuntu, you can install OpenBLAS by executing:sudo apt-get install libopenblas-dev liblapack-dev
Dependencies
Dlib
Install Dlib as a shared library
Installation
Configure PHP installation
Append the content below to php.ini
Tests
For tests, you will need to have the bz2 extension installed. On Ubuntu, it boils down to:
After you have successfully compiled everything, just run:
Usage
General Usage
A good starting point can be tests/integration_face_recognition.phpt. Check that first.
Basically, if you just want to quickly get from your image to a 128D descriptor of faces in the image, here is a really minimal example of how:
Location from where to get these models can be found on the DLib website, as well as in tests/integration_face_recognition.phpt test.
Specific use cases
face detection
If you want to use the HOG-based approach:
If you want to use the CNN approach (and CNN model):
The CNN model can get you slightly better results, but is much, much more demanding (CPU and memory, GPU is also preferred).
face landmark detection
Additionally, you can also use a class-based approach:
Note that, if you use a class-based approach, you need to feed the bounding box rectangle with values obtained from dlib_face_detection. If you use dlib_face_landmark_detection, everything is already done for you (and you are using the HOG face detection model).
face recognition (aka getting face descriptor)
Chinese whispers
Provides raw access to dlib's chinese_whispers function.
The client needs to build and provide edges. Edges are provided
as a numeric array. Each element of this array should also be a numeric array with 2 elements of long type.
Returned value is also a numeric array, containing obtained labels.
Features
- [x] 1. Face Detection
- [x] 2. Face Landmark Detection
- [x] 3. Deep Face Recognition
- [x] 4. Deep Learning Face Detection
- [x] 5. Raw chinese_whispers