Where does the module folder live in SS4? Under vendor folder?

Hi Guys, am upgrading a module from SS3 to SS4 and need advice please about where to shift the module folder (plus contents including .git). Do I place the module under the vendor folder? Thanks Cheers Antony

If you set it up as a silverstripe-vendormodule then it will get installed into the vendor directory of the site, but you don’t need to manually put it there.

The SS4 module standards are here: Modules – SilverStripe Documentation

They should explain the basic structure of where things go.

Publishing is much the same as before:
https://docs.silverstripe.org/en/4/developer_guides/extending/how_tos/publish_a_module/

Often the best way to see how it works is to look at an existing module. Here’s a very simple one I just started playing with: GitHub - DorsetDigital/silverstripe-http2

It’s worth noting that if you’re creating modules that live in the project (as opposed to being installed with Compoesr) that you can still have them in the project root folder like you did in SilverStripe 3.

The vendor/ folder is reserved for Composer installed modules, so don’t put anything into it manually.

Which directory? Under which directory? Where exactly do modules go?

As mentioned above, it depends on the type of module. If it’s a project-specific module that’s being installed manually, it can live in the project root directory.

If it’s a module which is being installed with composer, then composer decides where to put it. A silverstripe-module will most likely end up in the project root as it did with SS3.
A silverstripe-vendormodule will end up in a subdirectory of the vendor directory, (something like vendor/dorsetdigital/my-silverstripe-module) - it knows where to put it based on the content of the composer.json file in the module.

So first we need to start a project? And do you really need to inflict Composer on people?

Composer makes managing a SS4 site much easier IMHO. But if you don’t want to use it for your module, then you can just build it manually in the project root.

1 Like