Textpattern plugin and theme installer for Composer
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 4 commits ahead of gocom:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src/Textpattern/Composer/Installer
.gitignore
CONTRIBUTING.textile
LICENSE
README.md
composer.json

README.md

Textpattern Installer for Composer

Package directory | Issues

Install Textpattern CMS plugins and themes using Composer:

composer require textpattern/com_connect
composer remove textpattern/com_connect
composer update
composer install

Normally installing Textpattern plugins requires that you manually download an installation package, upload the package through your admin-panel, and then go through a multi-step installer process; rinse and repeat for every plugin, and when you need to update one.

With Composer, it's all managed through the dependency manager. Any theme or a plugin can be installed, updated, or uninstalled, using a single command. And it comes with all other Composers benefits such as being able to commit your package manifesto under version control system, and all of your teammates will have the same set of plugins synched without any extra fiddling.

Quick start for end-users

After installing Composer:

cd /path/to/your/textpattern/installation/dir
composer require textpattern/composer-lock:4.7.1
composer require rah/rah_replace textpattern/com_connect

As in the above, navigate to your Textpattern installation location (containing textpattern directory and index.php file), lock-in your installed Textpattern version (e.g. 4.7.1) using the textpattern/composer-lock meta-package so that Composer knows it, and then you are ready to install any plugins, themes or libraries like any other Composer package.

Quick start for developers

Example plugin | Example admin-theme

Plugins and themes are just like any other normal Composer package, but with a special type and a matching installer requirement in your composer.json:

{
  "name": "vendor/pfx_pluginname",
  "type": "textpattern-plugin",
  "require": {
    "textpattern/composer-installer": "*"
  }
}

Additionally the package should be named after the plugin or the theme. Available package types are:

  • textpattern-plugin: The package contains manifest.json formatted plugin sources. See an example plugin.
  • textpattern-plugin-package: The package contains collection of compiled plugin installer files. Any file that's name matches the format pfx_pluginname_v0.1.0.txt will be installed.
  • textpattern-admin-theme: The package is an admin-side theme. Themes are installed to ./textpattern/admin-themes directory.

Internals

The installer works by scanning composer.json file's sibling and child directories for a Textpattern installation. If found, it injects Textpattern to the currently running Composer process. It then collects any plugins and themes from Composer packages and installs them, invoking plugin-lifecycle updaters and installers as needed. This process can be compatible with, and used by, any plugin or a theme.

The installer doesn't require any extra configuration from the end-user or the developer. All it needs is a functional Textpattern installation, located either in the same directory as the composer.json file or in a child directory.

Requirements

  • Textpattern 4.6.x, 4.7.x
  • PHP >=5.5.38
  • PDO

Credits

Forked from the original work by Jukka Svahn (Gocom).