Problem
Utils::checkRequirement() reports findings via trigger_error(). The check is correct; the channel is the issue.
My setup: I run PHP through the official php:8.5-cli Docker image rather than installing PHP on the host, so my php is effectively docker run --rm -v $PWD:/app -w /app php:8.5-cli php. The base image ships without GMP or BCMath, which is exactly what the recommendation notice is about.
In frameworks that promote PHP errors to exceptions (Yii 2.0 in my case), the E_USER_NOTICE raised from WebPush::__construct() becomes a fatal ErrorException at container boot - crashing unrelated CLI commands that never send a push notification. Installing GMP fixes the symptom for me, but the library hard-coding how its diagnostics are delivered is the real design issue, and it'll resurface for anyone running on a minimal/containerized PHP.
Proposal
Accept an optional Psr\Log\LoggerInterface on WebPush::__construct() and forward it to Utils::checkRequirement(). When provided, log; when not, fall back to trigger_error.
Happy to open a PR.
Problem
Utils::checkRequirement()reports findings viatrigger_error(). The check is correct; the channel is the issue.My setup: I run PHP through the official
php:8.5-cliDocker image rather than installing PHP on the host, so myphpis effectivelydocker run --rm -v $PWD:/app -w /app php:8.5-cli php. The base image ships without GMP or BCMath, which is exactly what the recommendation notice is about.In frameworks that promote PHP errors to exceptions (Yii 2.0 in my case), the
E_USER_NOTICEraised fromWebPush::__construct()becomes a fatalErrorExceptionat container boot - crashing unrelated CLI commands that never send a push notification. Installing GMP fixes the symptom for me, but the library hard-coding how its diagnostics are delivered is the real design issue, and it'll resurface for anyone running on a minimal/containerized PHP.Proposal
Accept an optional
Psr\Log\LoggerInterfaceonWebPush::__construct()and forward it toUtils::checkRequirement(). When provided, log; when not, fall back totrigger_error.Happy to open a PR.