gabrielbull / php-ups-api

PHP Wrapper for all UPS API
MIT License
456 stars 255 forks source link

Error: Class 'Ups\Entity\Shipment' not found #246

Closed emanuelebord87 closed 4 years ago

emanuelebord87 commented 5 years ago

Hello,

I've install the package with composer and all requirements are satisfied but when i try to make a Shipment request I get this error:

Fatal error: Uncaught Error: Class 'Ups\Entity\Shipment' not found in ....

Where am I wrong? Thanks

robert-antczak commented 5 years ago

Hi. I had the same problem today. Try to insert backslash at the beginning of the path: \Ups\Entity\Shipment

peter279k commented 5 years ago

I don't have this issue and it's fine to load the Ups\Entity\Shipment class.

My installation steps are as follows:

php ~/composer.phar require gabrielbull/ups-api                394ms
Using version ^0.8.0 for gabrielbull/ups-api

The sample code snippets I execute:

require __DIR__ . '/vendor/autoload.php'
use Ups\Entity\Shipment;
new Shipment();
echo Shipment::class; // "Ups\Entity\Shipmen"
harshal17 commented 4 years ago

I am getting the same error today (10/23/2019)

Fatal error: Uncaught Error: Class 'Ups\Entity\Shipment' not found in

I tried adding the backslash before Ups as robert suggested but still get the same error. Anyone able to help?

robert-antczak commented 4 years ago

You can try to debug how the class is loaded. Check how looks file path in findFile and findFileWithExtension functions in vendor/composer/ClassLoader.php when autoloder tries load 'Ups\Entity\Shipment.

gabrielbull commented 4 years ago

@emanuelebord87 This library has no maintainer and is looking for one.