S
S
Sergey Pashkevich2018-01-07 04:28:28
Composer
Sergey Pashkevich, 2018-01-07 04:28:28

Why doesn't it find a class from the library when writing a package (wrapper) for Laravel 5?

Good time!
I'm trying to write a wrapper package for Laravel 5 using the begateway-api-php library.
I created a default structure for packages and set everything up. But in the wrapper class, the original package from the library is not connected .. writes Class not found and I can’t understand why this happens. I ran the 'composer dumpautoload' command cleanly and with the '--optimize' flag - I see that the namespaces were loaded in the autoloader, but the class is still not found.
Here is the structure of the package being created:
vAWXd8Jf1M6E6r.png
Here is the composer.json file from the package:
Y2L6ba3S9jdGbr.png
Here is the original composer.json file of the project where the package is connected:
e62ab82cf4.png
The package itself is initialized and connected successfully to the project , but as soon as it comes to creating a class from the included librarybegateway/begateway-api-php in the package, an error occurs that the class was not found.
Below is the wrapper class itself, in which the error occurs:
KAgZNVxS4L9kM2.png
And here is the error itself:
ZrJQbKaT9j6ZBA.png
Maybe someone has encountered such a problem and knows how to solve it?
Ready to provide additional information, if needed, to clarify and analyze the problem.
The same problem with another link library, such as Bugherd .
I would be very grateful for advice and help!

Answer the question

In order to leave comments, you need to log in

4 answer(s)
M
Maxim Fedorov, 2018-01-07
@Maksclub

Did composer pull dependencies? That is, in the vendor folder there is a class in the folder and the folder itself /vendor/begateway/?
You did not install this package through the composer and dependencies (begateway / begateway-api-php) for it, the program swears at its physical absence
Similarly, if you see that a class is not found - go and see if this class exists :) Your CEP :)

A
Alexander Pushkarev, 2018-01-07
@AXP-dev

This will solve the problem
composer dump-autoload

D
Dmitry, 2018-01-08
@Astatroth

Judging by the screenshot, you do not have the class itself in src.

A
Andrey, 2020-07-10
@SS_Andrey

I know it's too late, maybe it will help someone.
Perhaps only one composer was updated. Well, two of them need to be updated.
#cd "package composer directory"
#composer dump-autoload
and
#cd "project composer directory"
#composer dump-autoload

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question