Skip to content
CAI
Software that uses CAICheck a score

Hanson/vbot

40.7

Weak · 19 September 2026

4.8k

lines of production code

PHP

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

Vbot is a PHP-based WeChat bot framework that provides a CLI interface and an HTTP API for programmatic interaction with the WeChat platform. It manages user sessions, contacts, and diverse message types—including multimedia and system events—through a modular architecture featuring an observer pattern for event handling and an extensible plugin system. The system supports session persistence via database migrations and Redis caching, while offering robust error handling and logging capabilities.

How it got here

2016 — vbot architecture refactoring

7 changes.

The project was renamed to vbot and underwent a comprehensive architectural overhaul, replacing legacy code with a modular service provider pattern and dependency injection. This period established a robust core infrastructure featuring specialized factories, HTTP utilities, and support for diverse WeChat message types.

2017 — Core architecture and CLI foundation

10 changes.

This period focused on establishing the Vbot application's core infrastructure, including a robust bootstrap kernel, structured exception handling, and a CLI entry point. It introduced key functional modules such as contact management, multimedia message handling, and an extensible plugin architecture, while also implementing an Observer pattern for event-driven interactions.

Features

Add multimedia handling and message sending capabilities

The library now includes traits for handling multimedia content and sending messages. The new Multimedia trait provides methods to download media resources (with optional callbacks or automatic saving to a configured path) and upload videos or other media files via multipart requests. The SendAble trait introduces a standardized mechanism for sending messages, including a one-second delay after transmission to manage sync state.

src/Message/Traits · high confidence

Add vbot CLI entry point

A new executable script at bin/vbot has been added to allow users to run the Vbot application from the command line. This script ensures the code is executed via the CLI SAPI and bootstraps the application to run the main command handler.

bin · high confidence

Added CLI commands for session management and database initialization

New console commands have been introduced to the vbot application. The \vbot:clear\ command allows users to clear the current session, while the \vbot:migration\ command initializes the default database schema by creating a \user\ table with fields for identification, profile information, and timestamps. These commands are executed via the Symfony Console component and require a configuration file path to establish the database connection.

src/Commands · high confidence

Added specific exception classes for error handling

The library now includes dedicated exception classes for various error scenarios, including argument issues, configuration errors, group creation failures, extension problems, UUID fetching, initialization failures, login issues (both failure and timeout), observer not found, and web sync errors. These specific exceptions allow users to catch and handle distinct failure modes more precisely than relying on generic exceptions.

src/Exceptions · high confidence

Introduce Contact management module for WeChat interactions

This change introduces a new \src/Contact\ module to manage WeChat contacts, friends, groups, and special accounts. The \Contacts\ base class extends \Illuminate\\Support\\Collection\ and provides methods to search, retrieve, and format contact data (including emoji handling). Specific subclasses (\Friends\, \Groups\, \Members\, \Officials\, \Specials\) expose API methods for friend operations (add, approve, set remark/stick), group management (create, add/delete members, set name), and account retrieval. The \Myself\ class initializes the bot's own profile and configures per-user logging paths.

src/Contact · high confidence

Introduce console logging and QR code display components

Added the Console component to provide terminal output capabilities, including structured logging with timestamps and levels, and a dedicated QrCode class to render QR codes directly in the terminal for user authentication.

src/Console · high confidence

Introduce extensible plugin architecture for message handling

Adds a new extension system allowing developers to create modular plugins via the AbstractMessageHandler base class. This system supports enabling/disabling extensions via admin commands, reading configuration, and controlling message propagation (stopping further processing if a handler returns true). The MessageExtension class manages loading, initializing, and executing these service and base extensions.

src/Extension · high confidence

Introduce support utilities for HTTP, content processing, and file handling

Added new support classes to handle core infrastructure tasks: an HTTP client wrapper using Guzzle that manages cookies, handles timeouts, and implements retry logic on failure; a content processor that normalizes HTML, decodes entities, and maps WeChat-specific emoji codes to standard Unicode; a file utility for saving data with automatic directory creation; and a common utility class providing JSON validation, millisecond timestamps, and logic to uniquely identify WeChat groups and friends by nickname, pinyin, and member attributes.

src/Support · high confidence

Introduction of structured message types for WeChat interactions

The \src/Message\ module has been restructured to support a wide variety of WeChat message types, moving beyond simple text handling. New classes have been added to parse, display, and send specific content formats, including multimedia (Image, Video, Voice, Emoticon, File), rich content (Card, Official account articles, Share links, Mini Programs), and system events (Recall, Group changes, New friend requests, Red packets, Transfers). This change enables the application to correctly interpret incoming complex messages and provides the capability to send these diverse message types back to contacts.

src/Message · high confidence

Introduction of the Observer pattern for event handling

The library now uses an Observer pattern to manage lifecycle and message events. New classes have been added for QR code scanning, login success, re-login, exit, contact fetching, activation requirements, and incoming messages. These observers allow users to register custom callbacks for specific events, enabling more structured and extensible event handling within the application.

src/Observers · high confidence

New API handler for external command execution

Added a new API subsystem in src/Api that allows external applications to trigger bot actions via HTTP requests. The ApiHandler parses incoming JSON payloads to identify an action and its parameters, routing them to specific API classes like Search (for finding contacts) and Send (for sending messages). This introduces a structured way to interact with the bot's core functionality programmatically.

src/Api · high confidence

Architecture

Introduction of modular service providers for dependency injection

The application's foundation has been restructured to use a modular service provider pattern, introducing dedicated service providers for API, caching, console, contacts, exceptions, extensions, HTTP, logging, messages, observers, and server components. This change centralizes the registration of core services—such as the API handler, Redis cache, contact management, and message handling—into the IoC container, replacing the previous monolithic initialization approach with a more organized and extensible architecture.

src/Foundation/ServiceProviders · high confidence

Behavioural changes

Core architecture refactored with new factory and handler classes

The core logic has been restructured into dedicated components: ApiExceptionHandler now centralizes API error handling, while ContactFactory and MessageFactory manage the creation and storage of contacts and messages respectively. MessageHandler implements the main message listening loop with heartbeat support, and Server orchestrates the login and serving process, including optional Swoole integration via the new Swoole class. Sync handles long-polling for new messages, and ShareFactory parses shared content types. Session management is now handled by a dedicated Session class.

src/Core · high confidence

Initial project setup with bootstrap and legacy code removal

The src directory has been initialized with a bootstrap.php file that handles Composer autoloader inclusion, while the legacy Robot.php class (which previously handled WeChat login UUID retrieval via Guzzle) has been removed.

src · medium confidence

Introduce structured exception handling and application bootstrap

The application now features a dedicated exception handling system that converts PHP errors into exceptions, reports uncaught errors, and manages fatal shutdown events, ensuring more robust error visibility. A new bootstrap kernel validates the environment (PHP version, required extensions) and initializes core components like configuration, sessions, and logging paths before the application starts.

src/Foundation · high confidence

Test coverage

Removal of legacy test script

The legacy test file (test/test.php) has been removed. This file previously contained a simple script to instantiate the Robot class and print its UUID, indicating that the associated manual testing or legacy test coverage is no longer maintained in this location.

test · high confidence

Dependencies

Project renamed to vbot with expanded dependency set

The project has been renamed from 'wx-bot' to 'vbot', updating the namespace from Hanson\\Robot to Hanson\\Vbot and adding a CLI binary at bin/vbot. The dependency list has been significantly expanded to include Laravel components (illuminate/config, cache, filesystem, container, redis, database), Symfony Console, Monolog, Carbon, and PHP QR Code, while the composer.lock file has been removed.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 41.

Lenses

  • Code Health 97
  • Architecture 97
  • Maturity 30
  • Readiness 17
  • Security 90

Changes since last survey

  • 300 commits — 253 feature/other, 47 fixes

By area

  • (root) — 111 commits
  • (repo) — 91 commits
  • src/Message — 22 commits
  • src/Core — 19 commits
  • src/Foundation — 12 commits
  • example/Handlers — 10 commits
  • src/Extension — 10 commits
  • src/Contact — 5 commits
  • example/Example.php — 4 commits
  • src/Api — 4 commits
  • src/Console — 4 commits
  • src/Support — 3 commits
  • src/Observers — 2 commits
  • example/MessageHandler.php — 1 commit
  • example/example.php — 1 commit
  • src/Commands — 1 commit

Notable commits

  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • fix: Apply fixes from StyleCI
  • …and 280 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

Hanson/vbot was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 19 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 00cffc75fe54c7ecff1cc6c17bc965fb2432673c — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-13a154b7f5d1.