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

Mohsin
Mohsin

I wrote a plugin that loads several packages from packagist using composer. But now I want to allow “private packages” as well by offering a screen to load packages as 1. From Packagist, 2. From git repo, 3. Upload zip.

This way the user can have the packages of the services he wants. A good example for this is the Pay Plugin which loads paypal and stripe. Internally, paypal and stripe is built on Omnipay/Common which provides the consistent interface.

I see OctoberCMS has a ComposerManager to load plugin composer packages. But these work by calling the respective scripts(autoload_namespaces.php, autoload_psr4.php, etc.) within a pre-generated composer vendor folder (the one generated when author's upload plugins to octobercms.com).

I want to allow custom loading of these packages directly i.e. I want to present the user with a screen to choose between loading package from packagist, or load github repo, or even upload their own zip file. and then once package is loaded, my script will check for specific files and formats (basically to see if it’s compatible to my plugin) before adding it in a "services" folder inside my plugin and then load it.

My issue is that I don't know how to dynamically load these package namespaces into OctoberCMS's classMaps, psr4 and namespace pools. Is there any code or has such a thing already been written?

Last updated

1-1 of 1

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