/home/kueuepay/www/vendor/spatie/flare-client-php/src/Context/BaseContextProviderDetector.php
<?php

namespace Spatie\FlareClient\Context;

class BaseContextProviderDetector implements ContextProviderDetector
{
    public function detectCurrentContext(): ContextProvider
    {
        if ($this->runningInConsole()) {
            return new ConsoleContextProvider($_SERVER['argv'] ?? []);
        }

        return new RequestContextProvider();
    }

    protected function runningInConsole(): bool
    {
        if (isset($_ENV['APP_RUNNING_IN_CONSOLE'])) {
            return $_ENV['APP_RUNNING_IN_CONSOLE'] === 'true';
        }

        if (isset($_ENV['FLARE_FAKE_WEB_REQUEST'])) {
            return false;
        }

        return in_array(php_sapi_name(), ['cli', 'phpdb']);
    }
}
Best Practice

Best Practices

To ensure a smooth integration process and optimal performance, follow these best practices:

  1. Use secure HTTPS connections for all API requests.
  2. Implement robust error handling to handle potential issues gracefully.
  3. Regularly update your integration to stay current with any API changes or enhancements.