VOOZH about

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

⇱ hypervel/devtool | DeepWiki


Loading...
Menu

Overview

Purpose and Scope

The hypervel/devtool package provides 30 specialized commands for code generation and development workflows in the Hypervel framework (which extends Hyperf). The package depends on hyperf/devtool ~3.1.0, providing 28 generator commands that extend Hyperf\Devtool\Generator\GeneratorCommand and 2 standalone utility commands (WatchCommand and EventListCommand).

The package automates creation of application components including models, controllers, middleware, policies, database migrations, event handlers, and more. All commands follow Laravel-style make:* naming conventions and use stub templates for code generation.

This document introduces the package architecture, command registration system, and command categories. For detailed information about specific commands, refer to the relevant sections throughout this documentation.

Sources: src/ConfigProvider.php1-82 composer.json1-43

System Organization

Hypervel Devtool follows a modular architecture where each command is responsible for generating specific types of application components. All 30 commands are centrally registered through the ConfigProvider class, which implements a conditional registration pattern—if the base Hyperf\Devtool\Generator\GeneratorCommand class is not available, the system gracefully degrades by registering zero commands instead of causing fatal errors.

Command Registration Flow


Sources: src/ConfigProvider.php39-82

Key Components

ConfigProvider

The Hypervel\Devtool\ConfigProvider class serves as the package entry point, discovered by Hyperf's component scanner via the extra.hyperf.config key in composer.json31-34 The __invoke() method implements a fail-safe pattern at src/ConfigProvider.php43-45:

  1. Checks if Hyperf\Devtool\Generator\GeneratorCommand class exists
  2. If true, returns array with commands key containing 30 command class names
  3. If false, returns empty array (graceful degradation)

This prevents fatal errors when the hyperf/devtool dependency is unavailable.

ConfigProvider Class Structure


Sources: src/ConfigProvider.php39-82 composer.json31-34

Command Categories

The 30 commands registered in src/ConfigProvider.php48-79 are organized into functional categories:

CategoryCountCommands (Class Names)CLI Commands
Development Utilities2WatchCommand, EventListCommandwatch, event:list
Model System4ModelCommand, FactoryCommand, SeederCommand, ObserverCommandmake:model, make:factory, make:seeder, make:observer
Database Migrations7CacheTableCommand, CacheLocksTableCommand, SessionTableCommand, NotificationTableCommand, QueueTableCommand, QueueFailedTableCommand, BatchesTableCommandmake:cache-table, make:cache-locks-table, make:session-table, make:notifications-table, make:queue-table, make:queue-failed-table, make:queue-batches-table
HTTP Layer6ControllerCommand, MiddlewareCommand, RequestCommand, ResourceCommand, RuleCommand, ExceptionCommandmake:controller, make:middleware, make:request, make:resource, make:rule, make:exception
Event System6EventCommand, ListenerCommand, NotificationCommand, MailCommand, ChannelCommand, JobCommandmake:event, make:listener, make:notification, make:mail, make:channel, make:job
Other Generators5PolicyCommand, TestCommand, ConsoleCommand, ProviderCommand, ComponentCommandmake:policy, make:test, make:command, make:provider, make:component

All 28 generator commands extend Hyperf\Devtool\Generator\GeneratorCommand. The 2 utility commands extend Hyperf\Command\Command.

Sources: src/ConfigProvider.php48-79

Code Generation Workflow

Generator commands extending GeneratorCommand follow a template-based workflow:

Generator Command Execution Flow


Sources: src/ConfigProvider.php7-37

Installation and Requirements

Dependencies

Package requirements from composer.json22-25:

DependencyVersion ConstraintPurpose
php^8.2Minimum PHP runtime
hyperf/devtool~3.1.0Provides GeneratorCommand base class
hyperf/watcher(optional)Required for WatchCommand hot-reload

Installation

Install via Composer:


Hyperf discovers the package via extra.hyperf.config in composer.json31-34 which references Hypervel\Devtool\ConfigProvider. During bootstrap, the framework invokes ConfigProvider::__invoke() to register commands.

Dependency Check Pattern


Sources: composer.json22-25 composer.json31-34 src/ConfigProvider.php43-45 src/Commands/WatchCommand.php33-36

Package Architecture

The package integrates with Hyperf through a layered architecture:

Package Layering and Dependencies


Bootstrap and Registration Sequence


Sources: composer.json22-34 src/ConfigProvider.php39-82

Conclusion

The Hypervel Devtool package provides a robust set of code generation tools that enhance development productivity when working with the Hyperf framework. By automating the creation of common application components, it allows developers to focus on business logic rather than boilerplate code. The package's modular architecture makes it easy to extend with additional commands as needed.

For more detailed information about specific command categories and their usage, please refer to the appropriate sections in this documentation.