Download the PHP package theranken/ruelo without Composer
On this page you can find all versions of the php package theranken/ruelo. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download theranken/ruelo
More information about theranken/ruelo
Files in theranken/ruelo
Package ruelo
Short Description A PHP library for facial match verification and emotional analysis.
License MIT
Informations about the package ruelo
A powerful face recognition and analysis library for PHP using DeepFace, with support for file paths, base64 strings, and data URLs.
What is this?
This package provides robust face recognition, verification, and analysis capabilities using DeepFace and deep learning models. It supports multiple input formats and provides comprehensive error handling and validation. The backend is powered by a persistent Python FastAPI server for high performance and reliability.
Features
- Face Verification: Compare faces between two images with confidence scores
- Face Analysis: Get age, gender, emotion, and race predictions
- Multiple Input Formats: Support for file paths, base64 strings, and data URLs
- Base64 Utilities: Built-in methods for converting between formats
- Input Validation: Comprehensive error checking and validation
- Detailed Results: Get match status, confidence scores, and similarity metrics
- Error Handling: Clear error messages and consistent error format
- FastAPI Backend: Persistent Python API server for high performance
Requirements
PHP Requirements
- PHP 7.2 or higher
- php-fileinfo extension
- php-json extension
- Composer (for PHP dependencies)
Python Requirements
- Python >=3.8 or <=3.11
- tensorflow==2.11
- deepface==0.0.96
- opencv-python-headless==4.10.0.84
- numpy==1.24.4
- pillow==10.4.0
- pyyaml==6.0.2
- fastapi==0.115.2
- uvicorn==0.30.3
- python-multipart==0.0.9
- onnxruntime==1.17.0
- pydantic==2.10.6
- (see requirements.txt for details)
Installation
-
Clone or download the repository:
-
Install the PHP library via Composer:
Or if using as a dependency:
-
Install Python dependencies:
You can use the provided setup script:
On Windows, run:
-
Start the FastAPI server:
The server can start automatically when you use the library methods, or you can start it manually.
Automatic (recommended): The server starts automatically when you call
DeepFace::compare()orDeepFace::analyze().Manual start: Use the provided utility scripts:
If installed via Composer in another application:
To stop the server manually:
Or if installed via Composer:
Or directly:
-
(Optional) Test with the interactive CLI tool:
Run the interactive shell to test the library:
- (Optional) Docker usage: See below for Docker instructions.
Usage
Basic Face Comparison
Working with Base64 Images
Face Analysis
// The FastAPI server URL can be customized if needed: $deepface = new DeepFace('http://localhost:4800');
Using Static Helper Methods
// The CLI tool is no longer required. All operations are handled via the FastAPI server.
Interactive CLI Tool
The library includes an interactive command-line tool for testing and experimenting with face recognition and analysis features. This tool provides a simple interface to test the library without writing code.
Running the Interactive Tool
Example Session
The interactive tool supports:
- Face verification between two images
- Face analysis for age, gender, emotion, and race prediction
- Base64 testing with pre-encoded image files
- Clear screen and quit commands
Results Format
Face Comparison Results
Analysis Results
Error Format
Common error messages:
- 'Both image sources are required'
- 'Image file not found'
- 'Failed to execute Python script'
- 'Invalid JSON response'
- 'Database path not found'
How It Works
- The PHP library validates inputs and handles format conversions
- A Python FastAPI server using DeepFace processes the images
- Results are returned as JSON and parsed into PHP arrays
- Comprehensive error handling ensures reliable operation
Troubleshooting
Installation Issues
- Ensure Python 3.8+ is installed and accessible
- Install all required Python packages:
pip install -r requirements.txt - Check file permissions for the Python script
- On Windows, ensure the Python executable is in your PATH
- On Unix/Linux/macOS, make sure the setup.sh script is executable:
chmod +x setup.sh
Input Problems
- Verify image files exist and are readable
- Ensure base64 strings are properly formatted
- Check that data URLs include the correct MIME type
Docker Usage
You can run the FastAPI server in a Docker container for production use. Example Dockerfile:
Build and run:
License
MIT