Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Signal Laravel Package

hyperf/signal

Signal handling component for Hyperf. Register annotation-based handlers for OS signals such as SIGTERM, SIGHUP, and SIGUSR1, dispatching them safely in coroutine contexts to enable graceful shutdown and custom signal-driven workflows.

Deep Wiki
Context7

[READ ONLY]

Frequently asked questions about Signal
What is hyperf/signal used for?
hyperf/signal is a signal handling component for Hyperf applications. It lets you listen for POSIX signals such as SIGTERM, SIGINT, SIGHUP, and SIGUSR1 and run custom handlers in a coroutine-friendly way. Typical uses include graceful shutdown, worker reloads, and custom signal-driven workflows.
How do I install hyperf/signal?
Install it with composer require hyperf/signal in a Hyperf application. Then enable the component if your skeleton requires it and register signal handlers using the annotation or listener configuration shown in the package README. Keep the Hyperf framework version aligned with the component's Composer constraints.
Which system signals can I handle with hyperf/signal?
It supports common POSIX signals such as SIGTERM, SIGINT, SIGHUP, and SIGUSR1, subject to your operating system. Handlers are dispatched in a coroutine-friendly way so you can run Hyperf code safely. Signal availability differs on Windows, so this component is intended for Unix-like environments.
Does hyperf/signal work with Laravel?
No, hyperf/signal is built specifically for Hyperf and its coroutine runtime, not for Laravel applications. Laravel developers usually handle signals through Symfony Console events, process wrappers, or native pcntl functions. You can evaluate the concepts, but you cannot drop this package into a standard Laravel app as a Laravel signal handler.
How do I register a signal handler in Hyperf with hyperf/signal?
Register handlers using the component's annotation-based approach or its listener-based configuration, as described in the README. The handler method should contain the graceful shutdown or custom workflow logic you want to run when the signal arrives. Because execution is coroutine-friendly, avoid blocking calls that would stall the Hyperf event loop.
Can hyperf/signal be used for graceful shutdown?
Yes, it is commonly used to catch SIGTERM or SIGINT and begin a graceful shutdown. Your handler can stop accepting new work, let in-flight coroutines finish, and close resources before the process exits. This is particularly useful in Docker and Kubernetes deployments where the platform sends termination signals.
Is hyperf/signal compatible with Windows?
No, POSIX signals such as SIGTERM, SIGHUP, and SIGUSR1 are not available with the same semantics on Windows. hyperf/signal targets Unix-like systems where signal handling is supported. For Windows development, use platform-specific process control or test signal behavior on Linux.
How do I test signal handlers that use hyperf/signal?
Test the handler logic directly by invoking the handler method in a unit test with mocked dependencies. For integration coverage, start a disposable Hyperf process and send it a real signal from a test script, then assert on the shutdown behavior. Avoid sending signals to the main test runner process, and keep tests on Linux or macOS where POSIX signals exist.
What are alternatives to hyperf/signal?
Alternatives include native PHP pcntl_signal calls, Symfony Console signal events, Swoole signal APIs, and Hyperf process lifecycle hooks. The right choice depends on whether you need framework integration, coroutine safety, or simple process-level handling. hyperf/signal is the Hyperf-native option when you want annotation or listener-based signal handlers.
Is hyperf/signal production-ready and maintained?
It is part of the Hyperf ecosystem and is designed for lightweight integration with Hyperf applications. Check Packagist and the repository for the latest release, open issues, and compatibility notes before adopting it. Pin a version in Composer and validate graceful shutdown behavior in a staging environment that mirrors production.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
vento/laravel-airbrake
wfeller/laravel-batch
maco-studios/mage-os-installer
busarm/armie
siberfx/laravel-logger
kfteam1991/dcat-admin
dashed/dashed-laposta
dashed/dashed-ecommerce-montaportal
dashed/dashed-ecommerce-etsy
neohq/string-blade-compiler
log1x/acf-composer
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager