CakePHP 3 vendor file downloads

In cakephp 2, when I needed a provider or related class to load globally, I would add a requirement or application to use inside bootstrap.php from the main php.

In cakephp 3, where do I need vendor files? I don't want to declare to the vendor in every class and template file that I am using my vendor files.

http://book.cakephp.org/3.0/en/core-libraries/app.html#loading-vendor-files

+3


source to share


1 answer


Vendor files are 3rdparty files. Regular static utility classes are not vendor files, but your application files. You can put them under src/Lib/

. Just make sure you are using the correct namespace for your classes and add the correct operator use

where you need to use your class.



For example, if your class is lib src/Lib/FooBar.php

, then it must have classname App\Lib

and the use statement will use App\Lib\FooBar

.

+8


source







All Articles