{"record":{"id":"99d2c7ee21bd542c","repo":"Seldaek/monolog","slug":"the-curl-extension-is-needed-to-use-the-sendgridha","errorCode":null,"errorMessage":"The curl extension is needed to use the SendGridHandler","messagePattern":"The curl extension is needed to use the SendGridHandler","errorType":"exception","errorClass":"MissingExtensionException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Handler/SendGridHandler.php","lineNumber":53,"sourceCode":"    /**\n     * @param string|null $apiUser Unused user as of SendGrid API v3, you can pass null or any string\n     * @param list<string>|string $to\n     * @param non-empty-string $apiHost Allows you to use another endpoint (e.g. api.eu.sendgrid.com)\n     * @throws MissingExtensionException If the curl extension is missing\n     */\n    public function __construct(\n        string|null $apiUser,\n        protected string $apiKey,\n        protected string $from,\n        array|string $to,\n        protected string $subject,\n        int|string|Level $level = Level::Error,\n        bool $bubble = true,\n        /** @var non-empty-string */\n        private readonly string $apiHost = 'api.sendgrid.com',\n    ) {\n        if (!\\extension_loaded('curl')) {\n            throw new MissingExtensionException('The curl extension is needed to use the SendGridHandler');\n        }\n\n        $this->to = (array) $to;\n        // @phpstan-ignore property.deprecated\n        $this->apiUser = $apiUser ?? '';\n        parent::__construct($level, $bubble);\n    }\n\n    protected function send(string $content, array $records): void\n    {\n        $body = [];\n        $body['personalizations'] = [];\n        $body['from']['email'] = $this->from;\n        foreach ($this->to as $recipient) {\n            $body['personalizations'][]['to'][]['email'] = $recipient;\n        }\n        $body['subject'] = $this->subject;\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Handler/SendGridHandler.php#L35-L71","documentation":"Error \"The curl extension is needed to use the SendGridHandler\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Handler/SendGridHandler.php:53 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"57eb1028342134e701e77c617565d51b6e5a2a53","analyzedAt":"2026-08-17T02:36:30.259Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}