timnboys Posted October 19, 2016 Report Posted October 19, 2016 How to use composer in your modules to install extra dependences for your module? I am trying to flip my licensing around to enverido to use with my blesta(instead of WHMCS which I don't like using) does anyone know how to specify this: https://github.com/timnboys/php/blob/master/composer.json for enverido for my modules licensing? including my fraudrecord anti fraud module & etc? or how would I go about putting enverido into my modules? @cogative @Paul @Licensecart you got any ideas? as I don't use composer specifically in my modules and I know blesta uses it as well and don't want to confuse blesta by composer downloading the modules that might be already there? I just need help on figuring out how this will work and how to put it in my modules to replace WHMCS as my licensing system. Quote
cogative Posted October 19, 2016 Report Posted October 19, 2016 Composer will only install from the composer.json in the current working directory, so as far as I'm aware there shouldn't be any confusion between composer configurations for your modules and Blesta. I'm not sure if there's a way for Blesta to automatically execute composer to install the module, or if you have to do it yourself manually. I know when I was doing it I just executed "composer install" after uploading the module files. Are you trying to use the Enverido PHP library to license your module? Michael 1 Quote
Paul Posted October 19, 2016 Report Posted October 19, 2016 Blesta doesn't currently ship with a composer.json file, we remove it when we do our builds. So, I think you'll be fine. We may include it in the future, as we maintain our own composer repository here - https://composer.blesta.com/ Michael 1 Quote
timnboys Posted October 19, 2016 Author Report Posted October 19, 2016 34 minutes ago, cogative said: Composer will only install from the composer.json in the current working directory, so as far as I'm aware there shouldn't be any confusion between composer configurations for your modules and Blesta. I'm not sure if there's a way for Blesta to automatically execute composer to install the module, or if you have to do it yourself manually. I know when I was doing it I just executed "composer install" after uploading the module files. Are you trying to use the Enverido PHP library to license your module? yes I am I want to make it easy on myself. Quote
cogative Posted October 19, 2016 Report Posted October 19, 2016 Take a look at an example composer.json for a Blesta module here: https://github.com/enverido/blesta/blob/master/composer.json (@Paul might be able to provide a better example?) But to include the Enverido PHP library, you'd just add "enverido/php" under the "requires" section of the composer.json for the module. You could also remove GuzzleHTTP and PsySH from the composer.json, since they'll automatically be installed if you add "enverido/php". Quote
timnboys Posted October 19, 2016 Author Report Posted October 19, 2016 6 minutes ago, cogative said: Take a look at an example composer.json for a Blesta module here: https://github.com/enverido/blesta/blob/master/composer.json (@Paul might be able to provide a better example?) But to include the Enverido PHP library, you'd just add "enverido/php" under the "requires" section of the composer.json for the module. okay what if I haven't used composer for my module yet and don't have a composer.json yet? Quote
cogative Posted October 19, 2016 Report Posted October 19, 2016 See the edit I just made to my previous post, but essentially you could just throw that into your module's root directory, change some of the details to fit your module, add the "enverido/php" line to the "requires" section and you're pretty much good to go . In the module files themselves (eg: "mymodule.php") make sure to make a "require_once" call to the autoload.php file that's generated by Composer. If you google a general tutorial on Composer I'm sure this'll be covered. But essentially you require_once the autoload.php file, and that file automatically includes all the libraries you installed using Composer. Michael 1 Quote
Blesta Addons Posted October 20, 2016 Report Posted October 20, 2016 if you want to use enverido is not required from your part any other library . because your module/plugin will only send data to enverido server and check if is ok or not . if you want to use guzzlle for curlhttp package , then create a vendor directory and add in it the packages, in your composed file you should make them as required independencies, note that your files is coded and is not free so is better for you to include them in your project . Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.