tourze/face-detect-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tourze/face-detect-bundle

Composer 安装命令:

composer require tourze/face-detect-bundle

包简介

基于百度AI的人脸识别和校验模块

README 文档

README

Build Status Code Coverage PHP Version License Symfony

English | 中文

A comprehensive face detection and verification module for Symfony applications, supporting face profile management, verification strategies, and integration with various AI services like Baidu AI.

Table of Contents

Features

  • 🎯 Face Profile Management - Complete lifecycle management of face profiles
  • 🔐 Verification Strategies - Flexible and configurable verification rules
  • 📊 Operation Logging - Detailed operation tracking and status management
  • 🤖 AI Integration - Support for Baidu AI and other face detection services
  • 📋 Admin Interface - EasyAdmin-based management dashboard
  • 🧪 Comprehensive Testing - 1100+ test cases with >95% coverage

Installation

composer require tourze/face-detect-bundle

Quick Start

Step 1: Register the Bundle

// config/bundles.php
return [
    // ...
    Tourze\FaceDetectBundle\FaceDetectBundle::class => ['all' => true],
];

Step 2: Update Database Schema

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate

Step 3: Configure Services

The bundle automatically registers all services. You can configure them in your services.yaml:

# config/services.yaml
services:
    # Custom face detection service implementations
    App\Service\CustomFaceDetectionService:
        # Your implementation

Core Components

Entities

  • FaceProfile - Face profile storage with expiration and status management
  • VerificationStrategy - Configurable verification rules and priorities
  • VerificationRecord - Detailed verification attempt logging
  • OperationLog - Business operation tracking
  • StrategyRule - Fine-grained verification rules

Enums

  • FaceProfileStatus - Active, Expired, Disabled
  • VerificationResult - Success, Failed, Skipped, Timeout
  • VerificationType - Required, Optional, Forced
  • OperationStatus - Pending, Processing, Completed, Failed, Cancelled

Services

  • AdminMenu - EasyAdmin menu integration
  • Repository classes for all entities with comprehensive query methods

Configuration

Basic Configuration

# config/packages/face_detect.yaml
face_detect:
    # Configuration will be expanded based on your needs

Verification Strategies

Create verification strategies programmatically:

use Tourze\FaceDetectBundle\Entity\VerificationStrategy;

$strategy = new VerificationStrategy();
$strategy->setName('high_security')
    ->setBusinessType('payment')
    ->setDescription('High security verification for payments')
    ->setEnabled(true)
    ->setPriority(100)
    ->setConfig([
        'max_attempts' => 3,
        'timeout' => 30,
        'confidence_threshold' => 0.8
    ]);

Advanced Usage

Face Profile Management

use Tourze\FaceDetectBundle\Entity\FaceProfile;
use Tourze\FaceDetectBundle\Enum\FaceProfileStatus;

// Create a new face profile
$profile = new FaceProfile('user123', 'encrypted_face_features');
$profile->setQualityScore(0.95)
    ->setCollectionMethod('auto')
    ->setStatus(FaceProfileStatus::ACTIVE)
    ->setExpiresAfter(new \DateInterval('P1Y')); // Expires in 1 year

Operation Tracking

use Tourze\FaceDetectBundle\Entity\OperationLog;
use Tourze\FaceDetectBundle\Enum\OperationStatus;

// Create operation log
$operation = new OperationLog('user123', 'op_12345', 'payment_verification');
$operation->setVerificationRequired(true)
    ->setMinVerificationCount(2)
    ->setBusinessContext(['amount' => 1000, 'currency' => 'USD']);

Verification Records

use Tourze\FaceDetectBundle\Entity\VerificationRecord;
use Tourze\FaceDetectBundle\Enum\VerificationResult;

// Log verification attempt
$record = new VerificationRecord(
    'user123',
    $strategy,
    'payment',
    VerificationResult::SUCCESS
);
$record->setConfidenceScore(0.92)
    ->setVerificationTime(1.5)
    ->setClientInfo(['device' => 'iPhone', 'browser' => 'Safari']);

Testing

Run the test suite:

# Run all tests
./vendor/bin/phpunit packages/face-detect-bundle/tests

# Run with coverage
./vendor/bin/phpunit packages/face-detect-bundle/tests --coverage-html coverage

# Run specific test category
./vendor/bin/phpunit packages/face-detect-bundle/tests/Unit
./vendor/bin/phpunit packages/face-detect-bundle/tests/Integration

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

tourze/face-detect-bundle 适用场景与选型建议

tourze/face-detect-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tourze/face-detect-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tourze/face-detect-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 tourze/face-detect-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 19
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-18