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 1


You should do two steps to work with that library:

  1. Download it with your module
  2. 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:

  1. Declare its package as a repository and add dependency in 'required' section
  2. 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. 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
    – Ajay
    Oct 30, 2017 at 13:00
  • can u explain how to bundle it inside package
    – Ajwad Syed
    Nov 22, 2018 at 12:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.