VOOZH about

URL: https://deepwiki.com/friendsofhyperf/components/11-project-infrastructure

⇱ Project Infrastructure | friendsofhyperf/components | DeepWiki


Loading...
Last indexed: 14 February 2026 (15d5ca)
Menu

Project Infrastructure

This document provides an overview of the development and release infrastructure supporting the friendsofhyperf/components monorepo. It covers the continuous integration pipeline that validates code quality and tests across multiple PHP and Swoole versions, the multi-locale documentation website built with VitePress, and the automated tooling for releasing individual component packages from the monorepo.

For information about development tools used within the components themselves, see Development Tools.


CI/CD Pipeline

The project uses GitHub Actions for continuous integration and deployment. The pipeline is defined in two primary workflows: tests.yaml for quality assurance and release.yaml for package distribution.

Test Workflow Structure

The tests workflow runs on every push and pull request (excluding documentation changes), and on a daily schedule at 2:00 AM UTC. It consists of two sequential jobs: cs-fix and tests.

Test Workflow Diagram:


Sources: .github/workflows/tests.yaml1-94

Code Quality Checks

The cs-fix job runs on PHP 8.1 and performs two validation steps:

  1. Composer Normalization: Validates that all composer.json files in the monorepo follow a consistent format using composer normalize --dry-run. This check runs both on the root composer.json and recursively on all component-level files.

  2. PHP-CS-Fixer: Enforces code style standards across the entire codebase using vendor/bin/php-cs-fixer fix --dry-run --diff --verbose. The PHP_CS_FIXER_IGNORE_ENV environment variable is set to bypass environment checks.

Sources: .github/workflows/tests.yaml23-49

Test Matrix Configuration

The tests job uses a matrix strategy to validate compatibility across:

DimensionValues
Operating Systemubuntu-latest
PHP Version8.3, 8.2, 8.1
Swoole Extension6.1.3, 6.0.2, 5.1.8

This produces 9 parallel test executions (3 PHP versions × 3 Swoole versions). The matrix uses fail-fast: false to allow all combinations to complete even if one fails.

The PHP environment is configured with the following extensions: redis, pdo, pdo_mysql, bcmath, and swoole-{version} using shivammathur/setup-php@v2.

Sources: .github/workflows/tests.yaml50-77

Static Analysis and Testing

After environment setup, the workflow runs three verification steps:

  1. PHPStan Analysis: composer analyse src performs static analysis on all component source code.
  2. Type Coverage: composer analyse:types validates type annotations using Pest's type coverage feature.
  3. Service Setup: ./.travis/setup.services.sh starts a Redis container via Docker for integration tests.
  4. Test Execution: vendor/bin/pest --parallel runs the test suite with parallelization enabled.

The test execution uses nick-fields/retry@v3 with a 10-minute timeout and up to 2 retry attempts to handle transient failures.

Sources: .github/workflows/tests.yaml81-94 .travis/setup.services.sh1-11

Service Setup Script

The service setup script at .travis/setup.services.sh performs the following operations:


This starts a Redis container on port 6379 and verifies it is accessible.

Sources: .travis/setup.services.sh1-11


Release Workflow

The release workflow automates the process of splitting the monorepo into individual component repositories and tagging them with version numbers.

Release Workflow Diagram:


Sources: .github/workflows/release.yaml1-40

Release Process

The release workflow is manually triggered using the GitHub Actions workflow_dispatch event. It requires a tag input parameter (e.g., v3.1.0) and performs the following steps:

  1. Deep Clone: Checks out the repository with fetch-depth: 0 to retrieve the complete git history, necessary for subtree splitting.

  2. SSH Configuration: Writes the SPLIT_PRIVATE_KEY secret to ~/.ssh/id_rsa and configures SSH to skip host key verification with StrictHostKeyChecking no.

  3. Git Configuration: Sets the git user identity to huangdijia@gmail.com and Deeka Wong.

  4. Tag Validation: Verifies that the tag input is non-empty before proceeding.

  5. Subtree Split Execution: Invokes ./bin/release.sh with the provided tag, which splits each component directory into its corresponding standalone repository.

Sources: .github/workflows/release.yaml18-40

Repository Access Control

The workflow only executes on the canonical repository:


This prevents forks from accidentally triggering release operations.

Sources: .github/workflows/release.yaml14


Documentation Site Architecture

The documentation site is built using VitePress and supports four locales: Simplified Chinese (default), Traditional Chinese (Hong Kong), Traditional Chinese (Taiwan), and English.

Documentation Site Structure:


Sources: docs/.vitepress/config.mts1-179

Locale Configuration

The site defines locales in the locales object within config.mts:

Locale KeyLabelLanguage CodeLink Prefix
root简体中文zh/
zh-hk繁體中文(港)zh-hk/zh-hk/index
zh-tw繁體中文(臺)zh-tw/zh-tw/index
enEnglishen/en/index

Each locale imports its own configuration, navigation, and sidebar structures from dedicated TypeScript modules under docs/.vitepress/src/{locale}/.

Sources: docs/.vitepress/config.mts52-100

Theme Configuration

Common theme settings include:

  • Logo: /logo.svg displayed in the navigation bar
  • Outline Depth: [2, 4] shows headings from level 2 to level 4 in the page navigation
  • Edit Link: Points to https://github.com/friendsofhyperf/components/edit/main/docs/:path
  • Search Provider: Local search with locale-specific translations
  • Social Links: GitHub repository link

The simplified Chinese locale (root) includes additional UI translations:


Sources: docs/.vitepress/config.mts110-177

Analytics Integration

The site integrates two analytics platforms by injecting script tags into the HTML head:

  1. Baidu Analytics: Uses tracking ID df278fe462855b3046c941a8adc19064 via the standard _hmt array pattern.
  2. Microsoft Clarity: Uses project ID pgqv4ftymf for session recording and heatmaps.

Both scripts are embedded inline in the configuration.

Sources: docs/.vitepress/config.mts26-51

Markdown Enhancements

The site uses markdown-it-task-lists plugin to render GitHub-style task lists with checkboxes:


Sources: docs/.vitepress/config.mts101-106

Sitemap Generation

VitePress generates a sitemap at https://docs.hdj.me/sitemap.xml for search engine crawlers:


Sources: docs/.vitepress/config.mts107-109

Homepage Features

The homepage at docs/index.md uses VitePress's home layout to showcase key components:

FeatureDescriptionLink
SentryHyperf SDK for error tracking/zh-cn/components/sentry/
TelescopeDebug dashboard/zh-cn/components/telescope/
TinkerREPL console/zh-cn/components/tinker/
Web TinkerBrowser-based REPL/zh-cn/components/web-tinker/
EncryptionEncryption utilities/zh-cn/components/encryption/
CacheMulti-driver cache API/zh-cn/components/cache/
HttpClientHTTP client library/zh-cn/components/http-client/
Validated DTOData validation/zh-cn/components/validated-dto/
LockDistributed locking/zh-cn/components/lock/

The hero section displays:

  • Name: "Hyperf Fans"
  • Text: "最受欢迎的 Hyperf 组件"
  • Tagline: "让 Hyperf 像 Laravel 一样简单且强大 🚀"

Sources: docs/index.md1-50

Navigation Structure

The English navigation structure includes three main items:


Sources: docs/.vitepress/src/en/nav.ts1-14


Monorepo Management

The monorepo uses a "replace" strategy in the root composer.json to provide all 50+ component packages as a single installation. Individual components can also be installed separately from their split repositories.

Component Organization

Each component is located under src/{component-name}/ with its own:

  • composer.json defining the package metadata
  • src/ directory containing the implementation
  • ConfigProvider.php registering services with the DI container

Composer Scripts

The root composer.json defines automation scripts for common development tasks:

ScriptCommandPurpose
analysephpstan analyse --memory-limit 1024MRun static analysis on specified paths
analyse:typespest --type-coverageValidate type coverage in tests
cs-fixphp-cs-fixer fixAuto-fix code style violations
testpest --parallelExecute test suite in parallel

These scripts are invoked by the CI pipeline as described above.

Sources: .github/workflows/tests.yaml84-94

Subtree Split Process

The ./bin/release.sh script (referenced in the release workflow) performs subtree splitting to extract individual component histories into standalone repositories. This enables:

  1. Independent Versioning: Each component can be tagged with its own version
  2. Selective Installation: Users can install only the components they need
  3. Isolated History: Component repositories contain only relevant commits

The split process preserves git history and maintains proper author attribution.

Sources: .github/workflows/release.yaml39

CodeRabbit Configuration

The repository uses CodeRabbit for automated code review with the following settings:


This configuration enables Chinese language reviews, automatic review on pull requests and drafts, and auto-reply in discussions.

Sources: .coderabbit.yaml1-17


Development Environment Setup

Swoole Installation

For environments where Swoole is not pre-installed, the .travis/setup.swoole.sh script provides automated installation:

  1. PIE Installer: Downloads and installs PHP Installer for Extensions (PIE) version 0.2.0
  2. System Dependencies: Installs libcurl4-openssl-dev, libc-ares-dev, libpq-dev
  3. Swoole Compilation: Uses PIE to install Swoole with flags:
    • --enable-openssl
    • --enable-swoole-curl
    • --enable-cares
    • --enable-swoole-pgsql
    • --enable-brotli
  4. PHP Configuration: Adds extension=swoole and swoole.use_shortname='Off' to php.ini

The script verifies installation by running php --ri swoole.

Sources: .travis/setup.swoole.sh1-29

Environment Variable Compatibility

The CI environment sets PHP_CS_FIXER_IGNORE_ENV=1 to bypass PHP-CS-Fixer's environment validation, ensuring consistent code style checks across different PHP versions.

Sources: .github/workflows/tests.yaml20