Opencart 2 vendor
Category: Blog Categories / PHP

Integration Composer with Opencart 2

I used to work with Laravel, and packagist is my friend. I do really love composer. It’s really helpful for developer like me to integrate a new library in the project easier. Just a few command line and package name, then it will retrieve all require library into your local development.

Lately, I started working with Opencart, MVC for ecommerce application. It is a good platform, but something that annoying me the most if integrating a new library. So I decided to find a way to integrate composer with Opencart.

I create a composer.json file in root_project/system/ . Here is my example.

"require": {
"pda/pheanstalk": "^3.1",
"chrisboulton/php-resque": "1.2.x",
"robmorgan/phinx": "*",
"mailgun/mailgun-php": "~2.0",
"vlucas/phpdotenv": "^2.3",
"aws/aws-sdk-php": "^3.18"
"require-dev": {
"panique/php-sass": "1.0"

Then executing this command linke in terminal:  composer install

In Opencart 2 you don’t need to make other configuration or include require(“vendor/autoload.php”); because in system/startup.php there is a registry method¬†spl_autoload_register(‘vendor’);

Hope this could help you.

Leave a Reply

Your email address will not be published.