Skip to main content

Add a new library in Opencart (vendor/) with composer

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

Popular posts from this blog

Moodle 3.8.1+ - path leak via errors in several files

Moodle 3.8.1+ ----------------------------------------------- File: admin/mailout-debugger.php #!/usr/bin/php Notice : Disabled. in \admin\mailout-debugger.php on line 73 File: admin/settings/appearance.php Notice : Undefined variable: hassiteconfig in \admin\settings\appearance.php on line 10 Fatal error : Uncaught Error: Call to undefined function has_any_capability() in \admin\settings\appearance.php:10 Stack trace: #0 {main} thrown in \admin\settings\appearance.php on line 10 File: admin/settings/badges.php Notice : Undefined variable: hassiteconfig in \admin\settings\badges.php on line 30 Fatal error : Uncaught Error: Call to undefined function has_any_capability() in \admin\settings\badges.php:30 Stack trace: #0 {main} thrown in \admin\settings\badges.php on line 30 File: admin/settings/courses.php Notice : Undefined variable: hassiteconfig in \admin\settings\courses.php on line 32 Fatal error : Uncaught Error: Call to undefined function

2022 - Remove (the too many) Ads from Memu launcher

Simple method Download from pureapk "MEmu Launcher2" ex: MEmu Launcher2_v6.0.9_apkpure.com Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar) Longer method Install "Export Apk" Export the memu launcher2  Install purify https://github.com/echo-devim/purify/raw/master/Purify.apk use purify with the exported memu launcher 2 Install "System app remover" (root) remove from system apps the "memu launcher 2" import the "purified" MEmu Launcher2 apk with the Memu utility ("apk" on the right toolbar)