problem with Official PHP Client Library
i am using this plugin to send my wordpress mails via sendgrid. works perfectly. in my themes function.php file i want to do some custom api calls (get all bounces).
therefore i included the sendgrid php api library (github.com/sendgrid/sendgrid-php) via require_once in my functions.php file.
i get the following error
FastCGI sent in stderr: "PHP message: PHP Fatal error: Cannot declare class SendGrid\Email, because the name is already in use in /var/www/vhosts/xxx/wp-content/themes/xxx/vendor/sendgrid-php/lib/helpers/mail/Mail.php on line 877" while reading response header from upstream
when i deactivate the sendpress wordpress plugin, everything works fine. when i rename the Mail class in sendgrid-php/lib/helpers/mail/Mail.php on line 877 (in the Official PHP Client Library) it works also.
Hi @alexanderhofstaetter
Your question is similar to this question asked on the plugin forum: https://wordpress.org/support/topic/sendgrid-wordpress-plugin-official-php-client-library/
You'll find a more detailed answer there. Basically this is not possible because the Wordpress plugin already relies and includes the official SendGrid PHP library.