Search code examples
phpzend-frameworkimap

Zend framework retrieving email


When trying to implement this framework I ran into a issue with the directory. When I attemt to use this Zend i end up with

 Interface 'Zend\Mail\Storage\Folder\FolderInterface' not found in /home/content/54/9595754/html/zend/library/Zend/Mail/Storage/Imap.php

In the index.php file where I try to display the emails. I use an:

 set_include_path     
 include require_once('Imap.php');

The contents of Imap.php looks like:

 namespace Zend\Mail\Storage;

 use Zend\Mail;
 use Zend\Mail\Protocol;

 class Imap extends AbstractStorage implements Folder\FolderInterface,     Writable\WritableInterface

So what would i need to add to the Imap.php so that it dosent look inside this directory for the file.

I know understand that I need to try to implement a file in order for the framework to understand the directory they are in however when i try to implement an autoloader I get an error see example below.

require_once '../../../library/Zend/Loader/Autoloader.php';

Yields

require_once(Zend/Loader.php) [function.require-once]: failed to open stream:
No such file or directory in /home/content/54/9595754/html/zend/library/Zend/
Loader/Autoloader.php

Solution

  • Zend framework 2 and most other modern frameworks rely on autoloading for class loading. You have only required the Imap class but not the dependent interfaces. That's why you get this fatal error. I'd suggest you setup autoloading in your application. For an example how to set this up you can have a look into init_autoloader.php from the ZendSkeletonApplication.