I’ve come at this from an systems engineering background rather than developer. So far I’ve managed to get Trellis/Bedrock up and running with a couple of customised ansible roles for extra things I require on my servers (ioncube mainly).
I’m really close to cracking this nut…but I’m a bit lost on how to handle 3rd party wordpress plugins. I’ve got Toran up and running for a test, and it is proxying Packagist just fine. There’s quite a few 3rd party plugins that aren’t already supported by Composer that I need.
I’ve created git repos for the plugins, but I really have no idea what I need to do next. I’ve tried creating a composer.json file that has the download location of the zip file using dist…I’ve tried extracting the zip and uploading it to my repo, creating a matching .json file…and I’ve tried uploading the zip file into my repo with an accompanying.json. None of these are working.
Can someone explain to me what exactly needs to happen with a 3rd party plugin to add it to a repo and usable by Composer (pretend I am a bit slow ) ? It’s the last piece of the puzzle
I’m also curious on how to handle zip-files with toran/composer etc.
Currently all my 3rd party plugins are in their own git repo, where each version of the plugin has a git tag. In order for toran to handle these plugins, you must create a
composer.json file, and put it also in the git repo. After that, I put the name of my plugin and version (the git tag name) in the
composer.json file of my bedrock project. Then run the command
composer update. You can use the option
--prefer-source, as it can only get the contents of your 3rd party plugins via source.
An example of the composer.json for your 3rd party plugin is as follows:
Hey @nazeemsoeltan, thanks for the reply. I think I might be messing up the syntax of the composer.json file, so I’ll try what you suggest with the tags.
Just to be clear, when you say your 3rd party plugins are in their own git repo, do you mean in they are in the same format as they appear when running on the wordpress site?
So basically, if this is correct, you download the plugin, extract it, put it in a git repo with the composer.json file, correct?
If it’s possible to do it directly with the zip file, that would be really nice. I get the sense composer could handle this as I have read in the documentation it can fetch a zip file from a remote source. Just need to figure out how to get it to extract…I suppose I need to do some more reading.
Yes indeed. As an example, I’m using gravityforms in most of my sites. When a new version is released, I download the zip, extract it somewhere on my local disk, and the contents of the unzipped directory (in this case named gravityforms) are copied into the repository. I commit, add the tag and push the changes. Toran will detect the changes according to your timer settings of Toran.
I’m also curious about the zip file handling as my current solution takes a lot of steps.
Hey @nazeemsoeltan, I got this to work with zip files. The only caveat is that the .zip of the plugin needs to be accessible without a username or password. I just tested the ones I was after with wget to make sure I could download them without any problems.
Just add the following to your composer.json file:
It’s especially easy if the path to the plugin on the remote server always has the latest version without needing to change the actual zip file name in the URL. Then you just use a update the git tag when you know there is a new plugin version, commit and you can easily update wordpress install with the newest version.
Maybe this isn’t a revelation to the grizzled veterans out there, but figuring this out just made my life so much easier!