Welcome Guest, Not a member yet? Register   Sign In
Using 3rd Party libraries via composer
#1

Hello all,
There is a legacy application which has multiple (3rd party) libraries some of which are managed through composer and packagist. While the documentation states that it is a good practice to put such components in the /app/ThirdParty/ folder, I have a little doubt regarding the implementation.
While doing composer require ... in the aforementioned folder, I got a message as follows
Code:
No composer.json in current directory, do you want to use the one at [...]/www?

What am I supposed to do ? Also, assuming that a separate composer.json should be installed in the ThirdParty folder, how do I get composer to honour the vendor/autoload.php from the ThirdParty composer ?
Help is greatly appreciated.
Thanking you in advance.
Reply
#2

(This post was last modified: 10-12-2021, 10:50 PM by ikesela.)

add the psr4 setting in composer.json;

Code:
"psr-4": {
            "app\\ThirdParty\\LIB_NAME": "/app/ThirdParty/LIB_FOLDER"
        }
Reply
#3

> it is a good practice to put such components in the /app/ThirdParty/ folder

I guess it says about non Composer packages.

You should have only one `composer.json` in the project root directory.
And it is no problem installing composer packages in `vendor/`.
Reply
#4

Hello all,

I installed the required packages using composer in the root folder and it is working fine. autoload.php is automatically taken care by ci - so it may seem.

Thank you again.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB