I want to use a library that's registered with composer in Magento 2 admin. The library is https://packagist.org/packages/flagshipcompany/flagship-api-sdk
I have a custom module that adds a button to admin order view and on the click of the button, the controller is called. I need to use this library in that controller.
I'm very new to composer and Magento. I'm not even sure if my composer.json is correct.
I have executed composer install in my module directory and I have the vendor directory. The directory structure is
Magento2/app/code/MyCompany/MyModule/
Controller/Adminhtml/ControllerName/Index.php
etc/adminhtml/di.xml
etc/adminhtml/routes.xml
etc/module.xml
Plugin/....
composer.json
composer.lock
vendor/[all the composer generated directories]
I need to use require 'vendor/autoload.php' in Controller/Adminhtml/ControllerName/Index.php. But everytime I put this line of code, it crashes. Also, once I am able to use autoload.php, I need to create an object of class Flagship which is present at vendor/flagshipcompany/flagship-api-sdk/Shipping/Flagship.
TIA
composer.jsonthen paste it here, we will verify it :) - Damian Dziaduch