ostrolucky/polyfill-newrelic
Composer polyfill that defines New Relic PHP agent newrelic_* functions when the New Relic extension isn’t installed. Helps apps run on PHP setups without the extension while keeping calls to the agent API compatible.
monolog, psr/log) conflict with existing logging systems.NewRelicPolyfillServiceProvider or similar.config/newrelic.php can be extended to conditionally enable the polyfill (e.g., via environment checks like app()->environment('docker')).NewRelic\Middleware\NewRelic), the polyfill may need to patch these classes dynamically (risky; test thoroughly).single vs. stack handlers). Configure explicitly.config/app.php:
'providers' => [
OstroLucky\NewRelicPolyfill\NewRelicPolyfillServiceProvider::class,
],
Bootstrap/HandleExceptions or a custom service provider to enable the polyfill only when the native extension is missing:
if (!extension_loaded('newrelic')) {
$this->app->register(NewRelicPolyfillServiceProvider::class);
}
NewRelic facade, patch it to delegate to the polyfill when needed (requires careful facade binding).redis, database) to ensure background jobs are instrumented.NewRelic\Agent::recordCustomMetric).xdebug, opcache) to ensure no interference.ServiceProvider boot methods) that could cause issues.newrelic.ini settings (e.g., newrelic.appname) are respected by the polyfill.newrelic-php-agent plugins).composer.json to avoid unexpected breaking changes.NEWRELIC_POLYFILL_ENABLED) in a central config management tool (e.g., Laravel Forge, Terraform).config_cache to avoid runtime polyfill configuration issues.NewRelic\Agent) is viable long-term.if (class_exists(OstroLucky\NewRelicPolyfill\Poly
How can I help you explore Laravel packages today?