dvdoug/BoxPacker

Uncaught Error: Interface 'Psr\Log\LoggerAwareInterface' not found

mastmaster opened this issue · 4 comments

Hello guys,

I really need your help.

I had successfully installed it before some weeks, also I had asked for some suggestions too.
I have installed it through composer and it has downloaded prs/lod dependency etc...

Unfortunately, today, (not sure what I have done from then) it doesn't work anymore.

Lately, I updated composer v2.

I tested on a simple code but the issue is still there

require_once IBEN_ROOT_DIR . 'vendor/autoload.php';

use DVDoug\BoxPacker\Packer;
use DVDoug\BoxPacker\Test\TestBox; // use your own `Box` implementation
use DVDoug\BoxPacker\Test\TestItem; // use your own `Item` implementation

$packer = new Packer();
$packer->setMaxBoxesToBalanceWeight(12);


$packer->addBox(new TestBox('SMALL', 300, 300, 100, 100, 296, 296, 80, 1000));
$packer->addBox(new TestBox('BIG', 3000, 3000, 100, 100, 2960, 2960, 80, 2000));


$packer->addItem(new TestItem('Item A', 25, 25, 12, 400, false), 1); // item, quantity
$packer->addItem(new TestItem('Item B', 2500, 125, 12, 1000, true), 2);
$packer->addItem(new TestItem('Item C', 250, 250, 24, 200, true), 1);

try {
    $packedBoxes = $packer->pack();

} catch (Exception $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
}

I get this:
Fatal error: Uncaught Error: Interface 'Psr\Log\LoggerAwareInterface' not found
in /home/.../vendor/dvdoug/boxpacker/src/Packer.php on line 19

Maybe this will help:

Fatal error: Uncaught Error: Interface 'Psr\Log\LoggerAwareInterface' not found

in /home/.../vendor/dvdoug/boxpacker/src/Packer.php on line 26

Call stack:
include()
../vendor/composer/ClassLoader.php:444
Composer\A\includeFile()
..vendor/composer/ClassLoader.php:322
Composer\A\ClassLoader::loadClass()
spl_autoload_call()
../vendor/dvdoug/boxpacker/src/InfalliblePacker.php:18
include()
../vendor/composer/ClassLoader.php:444
Composer\A\includeFile()
../vendor/composer/ClassLoader.php:322
Composer\A\ClassLoader::loadClass()

That's weird, the PSR logging package is definitely in the dependency list (https://github.com/dvdoug/BoxPacker/blob/3.x/composer.json#L17). Can you try a composer dump-autoload and see if that fixes it, if not what does composer show say?

PS, thanks for the sponsor 🙇

Yes, I see everywhere PSR/log ...

I tried composer dump and composer dump --optimize but still the same issue.

I don't know what is happening. if you have another idea let me know please.

Here is my composer show

dvdoug/boxpacker      3.9.3  An implementation of the 3D (actually 4D) bin packing/knapsack problem (aka creating parcels by putting items into boxes)
psr/log               1.1.4  Common interface for logging libraries
setasign/fpdf         1.8.2  FPDF is a PHP class which allows to generate PDF files with pure PHP. F from FPDF stands for Free: you may use it for any kind of usage and modify it to suit your needs.
setasign/fpdi         v2.3.6 FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use ...   
wsdltophp/packagebase 2.2.3  Contains the base classes to be used by classes generated by wsdltophp/packagegenerator

PHP Warning: include(/home/.../vendor/composer/../psr/log/Psr/Log/LoggerAwareInterface.php): failed to open stream: No such file or directory in /home/.../vendor/composer/ClassLoader.php on line 571

PHP Warning: include(): Failed opening '/home/.../vendor/composer/../psr/log/Psr/Log/LoggerAwareInterface.php' for inclusion (include_path='.:/opt/cpanel/ea-php74/root/usr/share/pear') in /home/.../vendor/composer/ClassLoader.php on line 571

OMG fixed!

PSR was not on the server. But only in localhost. not sure how i did that
Visual Studio code never synchronised it.