Ubuntu – Uncaught Error: Class ‘Monolog\Logger’ not found

apache-2.4composerphp7Ubuntu

I use PHP 7.0 on Apache 2.4.20 and Ubuntu 16.04 LTS. I have followed this guide to have upload functionality and would like to know what I can do to fix the following error that I receive:

PHP Fatal error: Uncaught Error: Class 'Monolog\Logger' not found in
/var/www/vendor/dilab/resumable.php/src/Resumable.php:49\nStack
trace:\n#0 /var/www/upload.php(11):
Dilab\Resumable->__construct(Object(Dilab\Network\SimpleRequest),
Object(Dilab\Network\SimpleResponse))\n#1 {main}\n thrown in
/var/www/vendor/dilab/resumable.php/src/Resumable.php on line 49

Can someone help me overcome this error on my server?

Edit 1: Composer doesn't download any dependency named "Monolog" or "Logger", so why is that happening? (note that this might be a Composer question and not a PHP question after all…)

Best Answer

You have to install Monolog as well. Go to your project directory and execute:

composer require monolog/monolog
composer require php-console/php-console

Then edit your update.php and insert below use Dilab\Resumable;

use Monolog\Logger;
use Monolog\Handler\PHPConsoleHandler;

That should do the trick.