How to install Composer in Vtiger CRM

How to install Composer in Vtiger CRM

Composer is the most popular package manager. And it is sorely lacking when developing in Vtiger CRM. Today I will tell you my method of connecting this package to the system.

So let's start from the very beginning.

The first thing we need to do is install composer. I will not describe here the installation process in detail, it all depends on your operating system. To install, simply go to https://getcomposer.org/ and follow the instructions.

Now when composer is installed globally, go to the core vtigercrm folder and run the command:

composer install

After that, we just have to connect package manager to the CRM.

To do this, go to the index.php file and before the line

include_once 'vtlib/Vtiger/Module.php';

Just insert this:

include_once 'vendor/autoload.php';

After that vtiger crm should be broken) ... So, let's fix our 500 error.

Now you need to install some packages. Run the following command in the console:

composer require ezyang/htmlpurifier

Then this:

composer require phpoffice/phpspreadsheet

Now change file:

include/utils/VtlibUtils.php

Find this line:

include_once ('libraries/htmlpurifier/library/HTMLPurifier.auto.php');

Change it to this:

include_once ('vendor/ezyang/htmlpurifier/library/HTMLPurifier.auto.php');

Then you need to change file:

modules/Reports/ReportRun.php

Find line

require_once("libraries/PHPExcel/PHPExcel.php");

Change it to:

require_once("vendor/autoload.php");

If you want, you can remove folder libraries/PHPExcel

Now you can try to update smarty:

composer require smarty/smarty

And chage line in file includes/runtime/Viewer.php:

vimport ('~/libraries/Smarty/libs/SmartyBC.class.php');

To this:

vimport ('~/vendor/smarty/smarty/libs/SmartyBC.class.php');

Now you can delete smarty library folder if you want libraries/Smarty/libs

After that, Vtiger should work correctly.

And that's it, composer must be installed on your system. For testing, you can do the following. Try installing a useful debugging tool:

composer require kint-php/kint --dev

This command will install this package: https://github.com/kint-php/kint

Now go to file:

modules/Potentials/models/ListView.php

And before line

return $massActionLinks;

insert this

d($massActionLinks);

Now try to open the list of potentials and you will see a div with debug information in front of the table.

From now, you can safely install any packages via composer into your Vtiger CRM. And they will automatically be connected to the system.

Popular Posts

My most popular posts

Maximum productivity on remote job
Business

Maximum productivity on remote job

I started my own business and intentionally did my best to work from anywhere in the world. Sometimes I sit with my office with a large 27-inch monitor in my apartment in Cheboksary. Sometimes I’m in the office or in some cafe in another city.

Hello! I am Sergey Emelyanov and I am hardworker
Business PHP

Hello! I am Sergey Emelyanov and I am hardworker

I am a programmer. I am an entrepreneur in my heart. I started making money from the age of 11, in the harsh 90s, handing over glassware to a local store and exchanging it for sweets. I earned so much that was enough for various snacks.

Hire Professional CRM developer for $25 per hour

I will make time for your project. Knowledge of Vtiger CRM, SuiteCRM, Laravel, and Vue.js. I offer cooperation options that will help you take advantage of external experience, optimize costs and reduce risks. Full transparency of all stages of work and accounting for time costs. Pay only development working hours after accepting the task. Accept PayPal and Payoneer payment systems. How to hire professional developer? Just fill in the form

Telegram
@sergeyem
Telephone
+4915211100235