Post by louposk » Thu Oct 18, 2018 1:16 am

Hi all,
i am trying use composer for installing new libraries in opencart 3.0.
Inside folder storage/vendor, it seems that there are some libraries pre-installed using composer when you download initial zip package. Also, if you go to composer.json in root installation folder (outside upload folder), there is a property that says to install new libraries in upload/system/storage/vendor folder.

Code: Select all


...
"config": {
        "vendor-dir": "./upload/system/storage/vendor/"
    },
...
Have you ever tries to use composer *after* installing Opencart? If yes, how did you manage make it work?

Because i've tried multiple ways, none of them have worked.

Thank you for your time
-Konstantinos

Newbie

Posts

Joined
Tue Oct 16, 2018 2:12 am

Post by louposk » Sat Oct 20, 2018 2:52 pm

Anyone?

Newbie

Posts

Joined
Tue Oct 16, 2018 2:12 am

Post by opencart.my » Sat Oct 20, 2018 9:59 pm

Hi Konstantinos,

Yes, I'm able to do "composer require" and install new libraries without any problem. E.g.:

Code: Select all

$ composer require phpseclib/phpseclib
$ composer install
I even changed the "vendor-dir" to another directory and it just works.

However, I did have my composer path set in my bash on macOS, so I'm not using "php composer.phar".

Developing Quality OpenCart Extensions since 2011. View my Extensions.


User avatar
New member

Posts

Joined
Mon Jan 22, 2018 6:03 pm


Post by louposk » Sat Oct 20, 2018 10:19 pm

Hi and thank you for your answer,
from which location do you run the above commands?

-Konstantinos

Newbie

Posts

Joined
Tue Oct 16, 2018 2:12 am

Post by opencart.my » Sat Oct 20, 2018 10:49 pm

I ran the composer commands from the same location where my composer.json file is situated.

From OpenCart perspective it will be outside or parent of the 'upload' directory.

Developing Quality OpenCart Extensions since 2011. View my Extensions.


User avatar
New member

Posts

Joined
Mon Jan 22, 2018 6:03 pm


Post by louposk » Sun Oct 21, 2018 2:39 am

If I understand correct, in production the upload folder exist and if you want to install any new dependency you edit the composer file which exist in root folder?

In installation description of opencart its says that you should copy all files from upload folder to your root folder.

Newbie

Posts

Joined
Tue Oct 16, 2018 2:12 am

Post by opencart.my » Sun Oct 21, 2018 5:30 pm

If you are just installing new library you don't need to edit composer.json file directly. Calling "composer require" will automatically do include the dependency for you.

"Root folder" usually means your web root directory, where you can still have the "composer.json" file reside in the parent of the web root directory. Not advisable to have "composer.json" file reside in the same directory as your OpenCart store directory.

Example:

Code: Select all

/
/var/www/mystore.com/upload/index.php (OpenCart installation)
/var/www/mystore.com/composer.json

Developing Quality OpenCart Extensions since 2011. View my Extensions.


User avatar
New member

Posts

Joined
Mon Jan 22, 2018 6:03 pm

Who is online

Users browsing this forum: No registered users and 11 guests