If you have an already installed opencart store and you want to add new libraries or update the olde ones for security reasons (if they do not break everything), this is a possible alternative solution.
Copy the composer.json from a fresh package of your Opencart Version (You can find all the older versions opencart on bnit.it) in the "storage" folder.
The /storage/ folder, that is usually under the web root or in the system folder. Depends on your configuration.
The following is the content of composer.json for opencart 3.0.3.8
{
"name": "opencart/opencart",
"type": "project",
"description": "OpenCart",
"keywords": ["opencart", "ecommerce", "framework", "opensource"],
"homepage": "http://www.opencart.com",
"license": "GPL-3.0+",
"config": {
"vendor-dir": "./upload/system/storage/vendor/"
},
"require": {
"braintree/braintree_php" : "3.40.0",
"cardinity/cardinity-sdk-php": "^1.0",
"divido/divido-php": ">=1.1.1",
"klarna/kco_rest": "^2.2",
"php": ">=5.4.0",
"scssphp/scssphp": "1.1.1",
"twig/twig": "^2.4.8",
"zoujingli/wechat-php-sdk": ">=1.3.10"
}
}
Open the file with a text editor that supports utf8, like notepad++, vs.code, anything else.
Replace the following string
from
"vendor-dir": "./upload/system/storage/vendor/"
to
"vendor-dir": "./vendor/"
Open your console on your webserver and move to the storage folder
You can now run from this folder
composer update
or
composer require [whatevername/yourlibrarytoadd]
For example I added the Google api client
composer require google/apiclient:^2.12.1
Comments
Post a Comment