Question

I'm new to PHP, so forgive me for any missteps.

I'm using a Wordpress plugin called Short Code Exec

I am writing a pretty simple piece of code that is dependent on a specific PHP library (call it XYZ)

I notice that I need to use Composer to install this library

the library's docs say run

php composer.phar require blahblah/XYZ

But, how do I do this within this plugin?

Was it helpful?

Solution

You don't run composer within the plugin, you will need to either run it locally and upload the files it downloads/creates or run it on your server.

You will then include the autoload file like you would with a normal php project with in the plugin (ie. require '/vendor/autoload.php';) and then you run the rest of your code and the classes will be autoloaded for you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top