I am developing test (Custom Magento Extension) module and I want to integrate third party library into my Magento 2 extension which will be using files under this library. Can anyone suggest how to integrate it into extension ? API I am trying to integrate does not follow zend naming convention.
1 Answer
You should do two steps to work with that library:
- Download it with your module
- Make it available to the autoloader
The best way to solve all these steps is to find your library in Packagist and add it as a dependency in your module's composer.json.
If it is not available as composer package, you have another two options:
- Declare its package as a repository and add dependency in 'required' section
- Bundle it inside your package
Also if it's not a composer package, you'll need to configure your autoloader to work with that library. Here is a documentation for that.
-
can you please let me know for github.com/dompdf/dompdf lib Because I didn't get it , I want to use this lib without composer in my extension. Commented Aug 25, 2017 at 9:31
-
How can we use library without composer in Magento2.2 ? As putting custom library in lib folder works fine in Magento2.1.9 but it is not working in Magento2.2– AjayCommented Oct 30, 2017 at 13:00
-