PHP Fatal error: Trait 'ProtocolTrait' not found

I am using Oauth for gmail account, I followed this link but getting error as below

PHP Fatal error: Trait 'ProtocolTrait' not found in C:\inetpub\wwwroot\bephpforTteam\New\gmailread\vendor\zendframework\zend-mail\src\Protocol\Imap.php on line 16

Please help me

You should follow the introduction:
There will you find a complete package for download.

But keep in mind, this is only example code which is based on a very old and unsupported version of Zend Framework (v1). This will not work with the new version without changes.

I followed this tutorial but it gives error as below,

> PHP Fatal error: Uncaught Zend_Mail_Protocol_Exception: cannot connect to host; error = (errno = 0 )

What changes in zend framework are needed to implement oauth2?

Please keep in mind, this is an example from Google and I am not Google. I do not know this example!

No changes in Zend Framework. You must change the example code from Google if this should work if a newer version of ZF.

Try to connect yourself with the IMAP-Server from Google. Install the new version of zend-mail and follow this explanation:

Replace the require_once calls at the top with require 'vendor/autoload.php';. No one uses the require hell anymore.

1 Like