How to include external library in wordpress plugin

How can I make an external PHP library available with my plugin.

Where the library files need to be placed?

Related posts

Leave a Reply

2 comments

  1. The best way to include an external library is to put it in your plugins folder. Then just use require_once() wherever you need it. Depending on the size of the plugin and your type of programing this might be in the main plugin file or wherever you need that functionality.

  2. There is no central library folder for WordPress like you have for drupal. So you just include the library files within your plugin’s folder and use the function plugin_dir_path to figure out the include path.

    Another alternative is to distribute the library files as a separate plugin and then use TGM plugin activation to “require” that plugin:

    http://tgmpluginactivation.com/