plesk/plesk-ext-sdk

Uploading the vendor directory with the extension

Closed this issue · 5 comments

Fleuv commented

According to the getting started page of this repo you should upload the whole vendor directory generated by composer to the plesk server. However according to the example in the getting started manual, the majority of the composer files are dev dependencies and thus wouldn't be needed on the plesk server.

Please double check the files necessary to upload to the server to get the example extension working. The current situation is definitely wrong.

Hi Fleuv,

run Composer to build the required autoload files without the dev dependencies

composer install --no-dev

Use the update command to get the latest version of the dependencies.

Where exactly did you find the example (URL)?

Fleuv commented

Hi Kubik-Rubik,

Check out this section:
https://github.com/plesk/ext-skeleton#getting-started

composer create-project plesk/ext-skeleton my-extension

results in the creation of the src/plib/vendor dir if I'm not mistaking. However if you are developing you will need the dev dependencies so you would run composer install without the --no-dev argument. Then each time you want to test the extension you will also have to run composer with the --no-dev argument, what makes the development process even more inconvenient.

I understand what you mean. You don't need to use --no-dev as long as you are developing and testing the package on your Plesk server.

Use this option only if you submit your extension to the Plesk Extensions team (or share it with somebody).

Happy coding!

Fleuv commented

Oke just to clear up and prevent others from getting a headache when diving into this. If you make use of and have custom classes in the plib/library directory then you need to use composer in order to use them in your controller. I tried following the naming convention, however from the controller the class wasn't defined. Then I tried to use classes with a namespace according to the naming convention:

namespace PleskExt\ModuleIdCamelCase;

What didn't work at first but as soon as I included the vendor directory to the extension on the server it started working. Then I tried to change this namespace to something else, where after it stopped working again. Thus you have to follow the class name convention as well in your namespace!

@Fleuv Thanks for pointing this out. Have success!