Textpattern plugin and theme installer

Installs: 375

Dependents: 54

Suggesters: 0

Stars: 6

Watchers: 3

Forks: 2

Open Issues: 2


1.0.7 2017-03-15 18:46 UTC


Package directory | Issues

Install Textpattern CMS’ plugins and themes using Composer:

$ composer require rah/rah_replace
$ composer remove rah/rah_replace
$ 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/lock:4.6.2
$ composer require rah/rah_replace rah/rah_flat

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.6.2) using the textpattern/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/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.


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.


  • Textpattern 4.4.1, 4.5.7, 4.6.x
  • PHP >=5.5.38
  • PDO


1.0.7 – 2017/03/15

  • Fixed: Textpattern 4.6.x compatibility.

1.0.6 – 2014/03/20

  • Changed: Includes the flat PHP source files rather than writing the contents to the database. The include paths are relative and expect that the txpath constant is same as the real install location. This lets bytecode caching system cache the source, rather than it being loaded by eval from the database.

1.0.5 – 2014/03/19

  • Added: Suppress ErrorExceptions during installation. Certain Textpattern versions and plugins may invoke notices and warnings.
  • Added: Validate Textpattern database and connection using PDO.
  • Added: Textpattern 4.4.1 compatibility.

1.0.4 – 2013/05/12

  • Fixed: Fixed translation installation. Default Textpack language wasn’t installed when there was more than one language.
  • Fixed: Plugin collections support plugin installer files with underscores in the plugin name.
  • Changed: Manifest file’s validation is more strict about the specified name. This lowers the change of collisions with similarly named files found in packages, and makes sure plugins properly follow Textpattern’s plugin naming convention.
  • Changed: Join source and help files with two linefeeds instead of just one.

1.0.3 – 2013/05/09

  • Changed: Suppresses any notices and warnings generated by plugins and their installers.
  • Changed: Looks for default Textpattern installation location before searching. This saves resources and time spent in search, if Textpattern is found from the default location.

1.0.2 – 2013/05/07

  • Fixed: undefined variable notice that appears if the site is in debugging mode.

1.0.1 – 2013/05/05

  • Fixed: requirements.

1.0.0 – 2013/05/05

  • The first stable release.

1.0.0-alpha.6 – 2013/05/05

  • Fixed: Package collection installer.

1.0.0-alpha.5 – 2013/05/04

  • Fixed: Plugin uninstaller. Now correctly uninstalls plugin and then deletes files, instead of trying to do it the other way around.
  • Added: Textpattern version constraint. Makes sure the installer is only used on supported Textpattern versions.
  • Changed: Renamed the Composer package from rah/textpattern-plugin-installer to textpattern/installer.

1.0.0-alpha.4 – 2013/05/01

  • Added: new type “textpattern-admin-theme”. Supports admin-side themes.

1.0.0-alpha.3 – 2013/04/30

  • Fixed: Check permissions before trying to read help file.
  • Fixed: Only try to read contents of actual files when constructing help documentation.
  • Fixed: Works with any path structures, containing any characters in filenames, multi-byte safe.
  • Added: Strips surrounding whitespace from the imported PHP source code in addition to the closing tags.
  • Changed: Searches Textpattern installation from the current and the child directories, but doesn’t climb up. Otherwise it has the change of hooking to the wrong installation.

1.0.0-alpha.2 – 2013/04/29

  • Fixed: Installed packages don’t incorrectly report them as modified. Didn’t calculate MD5 checksums properly.
  • Changed: Does Textpattern injecting in the package type handler itself.

1.0.0-alpha.1 – 2013/04/29

  • Fixed: errors.
  • Added: new type “textpattern-plugin-package”.
  • Added: Supports multiple plugins in one package.

1.0.0-alpha – 2013/04/28

  • The first alpha.