A few of you have been asking about some of the Known dev tools that I use.

Well, I’ve been writing them as I go, and they’re a little bit dotted around, but since moving to composer I’ve been trying to link them up a bit.

Known Dev Scripts

The main dev scripts that I’ve been using are here. Requiring this package will also fetch the language tools scripts and the PHPCS code formatter config.

All of these are already included in the Known checkout in the vendor directory, if you’re checking out from git, and composer installing the dev dependencies (default).

Console Tools

Next are a set of console tools that I’ve built up over time which give me some ability to nudge data around, and to get various dumps of raw data.

They’re dotted around in their own repos, and can be installed individually, but for convenience you can grab them all in one go:

It goes without saying that these should not be installed on a production system – with great power, and all that.

Enjoy!

» Visit the project on Github...

Recently, the Composer Installers project added support for Known, which opened up the exciting possibility of using Composer to deliver Known plugins and Themes.

Those of you who are tracking GitHub, you might have noticed that all the plugins and themes have disappeared!

Fear not, however. They are now all in their own repositories and installable via composer.

This is pretty cool, as not only does this solve some of the distribution and directory naming issues we were having (since now, composer manages both the downloading and making sure the plugin is installed to the correct location), but it also makes it super easy to role custom builds of Known with just a change to one file!

Having the plugins in their own repos will also hopefully make it much less daunting for people to get involved with development.

I’ve written before how package authors can update their stuff to take advantage of this, but I’ve already updated most of the core plugins and themes.

Enjoy!

So, I’m delighted to say that what I consider to be an important landmark towards Known 1.0 has been reached, and that is that Composer Installers now supports Known plugins, themes and console plugins!

Currently support is only available in the development build, but support now should be included in the next release, which will hopefully come out soon!

This is a big deal for two important reasons; firstly it now becomes super easy to roll your own builds of Known, by simply supplying your own composer.json, and second, it solves the frustrating “checkout repository, move and rename” problem.

Making your plugin Composer ready

If you’re a plugin developer, there’s a few things you need to do in order to take advantage of this:

Create a composer.json file

Firstly you need to create a composer.json file. This file can contain a bunch of things, but at the very least you need to give your package a name, a version, and include the relevant composer installers instructions.

Here’s an example from my IPFS plugin, with the important parts in bold.

{
"name": "mapkyca/known-ipfs",
"type": "known-plugin",
"description": "Adds IPFS support to Known",
"version": "0.1.4",
"homepage": "https://www.marcus-povey.co.uk",
"keywords": [
"known",
"plugin",
"ipfs"
],
"license": "GPL-2.0",
"authors": [
{
"name": "Marcus Povey",
"email": "marcus@marcus-povey.co.uk"
}
],
"require": {
"php": ">=7.1",
"cloutier/php-ipfs-api": "^0.0.6",
"composer/installers": "~1.0"
},
"extra": {
"installer-name": "IPFS"
},
"require-dev": {
"mapkyca/known-language-tools": "^1.0",
"mapkyca/known-dev-scripts": "^1.0",
"mapkyca/known-phpcs": "^1.0"
}
}
  • name: the name of the repository (used for packagist)
  • type: should either be known-plugin known-console or known-theme
  • version: version of the plugin, again for packagist
  • “composer/installers”: “~1.0” in require composer your plugin needs to require the installers plugin. This is also included by Known core, so don’t worry too much if you forget!
  • “installer-name”: “IPFS” this tells installers that your plugin should be installed in the named directory. So in this case instead of installing the plugin as the repo name (known-ipfs), it’ll install as ‘IPFS’. This is of course the correct plugin name according to its class hierarchy… so no more renaming!

Create a tagged release

Write your code, and then create a tagged release matching the version value in your composer.json.

Submit to packagists.org

Finally, submit your plugin to packagists.org in order to make it available for other Known installations to use!

Enjoy!