Need help installing and using PHP/Imap

Viewed 19

I install php/imap through composer enter image description here

response after install enter image description here

Installed package and site directory

enter image description here

PHP file code enter image description here

fatal error response enter image description here

Help solve fatal error

PHP v7.4

what am I doing wrong?

Changed the code

Result

1 Answers

Make sure to autoload your vendor directory. Not sure what namespace that package uses so you might need to use ... under that, or fully qualify that package if you haven't done so.

<?php 

require __DIR__ . '/vendor/autoload.php';

...

Update

enter image description here

Notice, it is looking for the vendor directory inside your www directory so you can either,

  1. run composer require... from inside your www directory. This will generate the vendor directory inside the www directory, or
  2. change the path to account for the vendor directory being up a directory. Ex. require __DIR__ . '/../vendor/autoload.php';. Notice the /../

If I were you, I'd go with #1 and have the vendor directory inside you www. This is the standard way to do things.

Related