wordpress icon indicating copy to clipboard operation
wordpress copied to clipboard

problem with Official PHP Client Library

Open alexanderhofstaetter opened this issue 8 years ago • 1 comments

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.

alexanderhofstaetter avatar Aug 25 '17 12:08 alexanderhofstaetter

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.

sebastianplesciuc avatar Aug 25 '17 12:08 sebastianplesciuc