A
A
Alex2019-12-06 17:27:17
PHP
Alex, 2019-12-06 17:27:17

How to use use outside of the vendor folder?

There is a vendor folder with an addon. Inside the folder there is index.php, where it is quietly written

require_once 'vendor/autoload.php';
use GIFEndec\Color;
use GIFEndec\Encoder;
use GIFEndec\Frame;

However, the php file of the main project is located outside the vendor (/proj/crt.php), and the vendor folder (/proj/gifendec/vendor).
And if in crt.php write require_once 'gifendec/vendor/autoload.php' and write use GIFEndec\Encoder;
php error occurs.
I don’t quite understand how then to use use outside the vendor folder , tell me, please?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
FanatPHP, 2019-12-06
@alexjet73

Judging by the error, you put use in some not very decent place.
Also Learning Paths in the File System

P
Pavel Sakharov, 2019-12-06
@desbiger

You probably mean that the index.php file is at the same level as the vendor folder. Otherwise, require would not work and there would be an error. Show the text of the error. Or you have another vendor folder in your vendor folder, which explains the absence of errors in the index.php file. In this case, you need to write the path require_once 'gifendec/vendor/vendor/autoload.php' or remove this extra folder)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question