This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

sokser+deatr10685
sokser+deatr10685

Can someone please provide an example of the appropriate directory to store various libraries and scripts that would be used by multiple plugins. I can easily create a random folder, but I would like to follow best practices. Thanks.

alxy
alxy

You should use Composer to include external libs. If you provide a composer.json in your root plugin directory, these updates will be pulled automatically during installation. However, if you are at the development stage, you will have to run composer update manually. The autoloading is handled by october as well. Once the plugin is installed, the composer library will be available in your entire installation.

oleksiyros
oleksiyros

I put composer.json in plugin root folder. but when I run next command it does not upload external libraries. I previously run it manually but then I get "Cannot redeclare ..." error for a sub-dependent library (another library that my external library depend on). What should I do. What is the general correct process to install dependancies? {code} php artisan plugin:refresh authorname.pluginname {code} Thank you

pratyushpundir6424
pratyushpundir6424

@oleksiyros It's should work exactly as @alxy mentioned.

Make sure you do a composer dump-autoload inside your project root and your plugin root. After that just run composer install or composer update inside your plugin root and you should be good to go. You can see an example of how I use composer to require the stripe-php inside my plugin here https://github.com/pratyushpundir/oc-sublimeStripe

Last updated

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.