VOOZH about

URL: https://deepwiki.com/hypervel/support

⇱ hypervel/support | DeepWiki


Loading...
Menu

Overview

This document provides an overview of the hypervel/support package, a foundational utility library for the Hypervel framework built on top of Hyperf 3.1. It covers the package's purpose, dependencies, architectural patterns, and the facade-based API surface that applications interact with.

For installation and configuration instructions, see Getting Started. For detailed architectural patterns, see Core Architecture.

Purpose and Scope

The hypervel/support package serves as the infrastructure layer for the Hypervel framework, providing:

  • Facade System: Static API layer for convenient access to framework services
  • Core Patterns: Reusable architectural patterns (Manager, DataObject, ServiceProvider)
  • Helper Functions: Global utility functions for common operations
  • Testing Infrastructure: Fake implementations for isolated testing

This package is designed to be a dependency for other Hypervel components and application code, offering a Laravel-like developer experience on top of Hyperf's high-performance foundation.

Sources: composer.json1-50

Package Identity

PropertyValue
Package Namehypervel/support
NamespaceHypervel\Support
Minimum PHP8.2
LicenseMIT
Repositoryhttps://github.com/hypervel/components

The package follows PSR-4 autoloading standards and automatically loads two helper files: src/Functions.php and src/helpers.php, which provide approximately 40 global utility functions.

Sources: composer.json2-4 composer.json22-23 composer.json32-39

Core Dependencies


Dependency Purposes

DependencyPurpose
hyperf/contextCoroutine-safe context management for request-scoped data
hyperf/supportBase Hyperf utilities and contracts
hyperf/stringableFluent string manipulation interface
hyperf/tappableTrait for tap/pipe method chaining
hyperf/collectionBase Collection implementation
nesbot/carbonAdvanced date and time manipulation
league/uriRFC 3986 compliant URI manipulation

Sources: composer.json22-31

Architectural Layers

The package follows a multi-layer architecture with clear separation of concerns:


Sources: composer.json32-39

Facade Ecosystem

The package provides a comprehensive facade layer that serves as the primary API surface for applications. Each facade resolves to a concrete service implementation through the PSR-11 container.

Complete Facade Mapping


Facade Categories

CategoryFacadesPrimary Use Cases
HTTPRequest, Response, Cookie, Http, URLRequest handling, response generation, HTTP client operations
RoutingRouteRoute registration, URL generation, model binding
DataDB, Cache, Redis, QueueDatabase queries, caching, message queues
ViewView, Blade, LangTemplate rendering, localization
SystemEvent, Bus, Validator, BroadcastEvent dispatching, validation, real-time broadcasting

For detailed facade documentation, see Facade System.

Sources: composer.json34

Core Architectural Patterns

The package implements three foundational patterns that enable extensibility and code reuse:

Pattern Overview

PatternBase ClassPurpose
FacadeHypervel\Support\Facades\FacadeStatic proxy to container-resolved services
ManagerHypervel\Support\ManagerMulti-driver service management with pooling
ServiceProviderHypervel\Support\ServiceProviderFramework extension and service registration
DataObjectHypervel\Support\DataObjectAuto-casting data transfer objects

Pattern Relationships


For detailed pattern documentation, see:

Sources: composer.json32-39

Helper Functions

The package automatically loads global helper functions from two files, providing quick access to common operations without requiring facade usage:

Helper File Structure

FilePurposeExample Functions
src/helpers.phpCore utilities (~40 functions)collect(), data_get(), retry(), env(), blank(), filled()
src/Functions.phpAdditional utilitiesFramework-specific helper functions

Helper Categories


For comprehensive helper function reference, see Helper Functions.

Sources: composer.json36-39

Testing Infrastructure

The package provides first-class testing support through fake implementations that replace real services during tests:

Available Fakes

FacadeFake ImplementationKey Assertions
EventEventFakeassertDispatched(), assertNotDispatched(), assertListening()
QueueQueueFakeassertPushed(), assertPushedOn(), assertNotPushed()
HttpHTTP stubbing via Http::fake()assertSent(), assertNotSent(), assertSentCount()

Testing Architecture


For detailed testing documentation, see Testing Infrastructure.

Sources: composer.json32-39

Package Structure

The package follows a standard PSR-4 structure with autoloading configuration:

Directory Layout

PathPurpose
src/Main source code root (PSR-4: Hypervel\Support)
src/Facades/Facade implementations
src/helpers.phpGlobal helper functions
src/Functions.phpAdditional utility functions
composer.jsonPackage definition and dependencies

Autoloading Configuration

The package uses two autoloading strategies:

  1. PSR-4 Autoloading: Hypervel\Support\ namespace maps to src/ directory
  2. File Autoloading: Automatically loads src/Functions.php and src/helpers.php on every request

This configuration ensures that all facades, classes, and helper functions are immediately available without manual imports.

Sources: composer.json32-39

Design Philosophy

The hypervel/support package is designed with the following principles:

1. Developer Experience First

  • Facade Layer: Provides Laravel-like static API for familiarity
  • Helper Functions: Quick access to common operations without class imports
  • Type Safety: Leverages PHP 8.2+ features for better IDE support

2. High Performance Foundation

  • Built on Hyperf 3.1, optimized for Swoole coroutines
  • Coroutine-safe context management via hyperf/context
  • Connection pooling support through Manager pattern

3. Extensibility

  • ServiceProvider System: Clean extension points for package authors
  • Manager Pattern: Easy addition of custom drivers
  • Facade System: Swappable implementations for testing and customization

4. Testing-First

  • Comprehensive fake implementations
  • Assertion methods for verification
  • Easy isolation of external dependencies

Sources: composer.json1-50

Version Information

PropertyValue
Current Branch0.3-dev
StabilityDevelopment
PHP Requirement^8.2
Hyperf Version~3.1.0

Sources: composer.json41-49