Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Php Facedetection

Php Facedetection Laravel Package

mauricesvay/php-facedetection

Pure-PHP face detection library for images. Scans photos for frontal faces and returns bounding-box coordinates, with no OpenCV or external binaries required. Useful for cropping avatars, tagging photos, or adding basic image analysis to Laravel/PHP apps.

View on GitHub
Deep Wiki
Context7

PHP class to detect one face in images. A pure PHP port of an existing JS code from Karthik Tharavad.

Frequently asked questions about Php Facedetection
How do I install mauricesvay/php-facedetection in a Laravel app?
Install it with Composer using composer require mauricesvay/php-facedetection. The package is framework-agnostic, so in Laravel you typically wrap it in a small service class, load the bundled detection.dat cascade, call faceDetect() on an image path, and read getFaces(). Confirm the 0.1.0 release and autoload behavior in a spike before pinning it.
Does this package work with Laravel 10 or 11 and PHP 8?
There is no Laravel-specific integration, and the upstream codebase dates from around 2016, so PHP 8 and current Laravel versions are not officially guaranteed. Treat PHP 8 compatibility as something you must verify or patch yourself. Run a time-boxed spike on your target PHP and Laravel stack, and fork or vendor the package if fixes are needed.
What are the server requirements for pure-PHP face detection?
You need PHP with the GD extension enabled and the bundled detection.dat Haar cascade file. No OpenCV, compiled extensions, or external binaries are required. Budget CPU and memory for image decoding and scanning, and validate uploaded MIME types, sizes, and dimensions before detection.
How do I detect multiple faces and get bounding box coordinates?
Call faceDetect() on the image and then getFaces() to retrieve bounding-box coordinates and sizes for each detected face, including multiple faces. Keep the package return types out of your domain code by mapping results to your own value objects or arrays. This makes it easier to swap in OpenCV, MediaPipe, or a cloud API later.
Can I crop a detected face to JPEG in one call?
Version 0.1.0 adds cropFaceToJpeg, which detects and crops a face to JPEG in a single call. That is convenient for simple avatar cases, but the JPEG quality and compression settings and the crop framing are decided inside the package. If you need square avatars, consistent padding, transparency, or non-JPEG output, keep your own GD or Intervention Image crop path.
Is this package fast enough for real-time or high-volume face detection?
No. Pure-PHP Haar cascade scanning is CPU-bound and unsuitable for real-time, high-resolution, or high-throughput workloads. Resize images before detection, run jobs asynchronously, and benchmark latency and throughput against a representative image corpus. For production scale, consider a dedicated detection service instead.
What license does php-facedetection use, and is GPL-2.0 safe for my Laravel app?
The package is GPL-2.0 licensed, which carries copyleft obligations that may not fit proprietary or closed-source distribution models. Get legal review before shipping it in a commercial Laravel application. If GPL is unacceptable, use a permissively licensed alternative or an external detection API.
How accurate is the Haar cascade face detection compared with OpenCV or cloud APIs?
It uses a lightweight Haar classifier and is best for frontal faces in low-stakes use cases such as basic avatar cropping or photo tagging. Expect limited accuracy, possible false positives and false negatives, and no landmarks or confidence scores. If accuracy matters, compare against OpenCV, MediaPipe, or a cloud face-detection API on your own corpus.
Should I run face detection in a Laravel queue job?
Yes. Face detection and cropping should run in Laravel queue jobs rather than directly in controllers or models. Store originals and derived images with Laravel Storage, validate uploads, and return a storage path or stream instead of a package object. This keeps request latency low and lets you retry or scale workers independently.
Is mauricesvay/php-facedetection still maintained, and should I fork or vendor it?
Treat it as unmaintained: the upstream is archived, the code is from the 2016 era, and the 0.1.0 release on an archived package raises provenance questions. Review the diff, confirm who published it, and pin a specific version. For production, vendor or fork it and assign ownership for PHP 8 compatibility, security review, and bug fixes.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo