Loads Composer generated autoload files in Textpattern CMS

Fund package maintenance!

Installs: 64

Dependents: 6

Suggesters: 0

Security: 0

Stars: 2

Watchers: 4

Forks: 1

Open Issues: 0


0.3.2 2019-03-24 19:46 UTC

This package is auto-updated.

Last update: 2024-04-18 12:24:43 UTC


Download | Packagist | Issues

This Textpattern CMS plugin automatically loads the autoload file generated by Composer dependency manager. Fits well together with textpattern/installer and textpattern/lock to complete the Textpattern and Composer integration. Rah_autoload removes any need to manually import the autoload file, and allows plugins access their dependencies.


Using Composer:

$ composer require rah/rah_autoload

Or download an installer package.


Using in your plugins

To use rah_autoload with your Composer distributed plugins, just add it as a dependency to your composer.json:

    "require": {
        "rah/rah_autoload": "*"

And that’s it. Rah_autoload gets installed with your plugin, the autoload file is loaded in Textpattern and you can access your dependencies.

Invoking the autoloader

The plugin and autoloader is invoked automatically as long as the plugin is enabled, but the autoloader can be invoked manually too, once installed. Normally this isn’t required, but if you want to make sure autoloader is initialized before you try to access your dependencies, you may invoke the plugin by our own in your plugin.

You will be able to invoke the autoloader like any other plugin using Textpattern’s native plugin management functions such as load_plugin() and require_plugin(). You don’t need to do anything other than load the plugin.

load_plugin('rah_autoload', true);

The above will initialize the autoloader as long as its installed, regardless of its type or status. The plugin and autoloader is initialized only once. Subsequent load and require statements don’t have any impact or eat resources. This basically means you can safely “spam” the load_plugin() when ever you need an autoloader or class maps generated by Composer.


Version 0.3.2 – 2019/03/24

  • No actual changes, just quality of life.

Version 0.3.1 – 2014/03/28

  • Updated source comment.

Version 0.3.0 – 2014/03/24

  • Removed: xrstf/composer-php52 support.
  • Removed: Preferences. Due to textpattern-installer changes, the plugin can now work automatically. As plugin source is loaded from vendors directory, the source file itself will be able to tell where the autoloader is located.

Version 0.2.1 – 2013/05/20

  • Fixed: Reported version number.

Version 0.2.0 – 2013/05/20

  • Added: Can load PHP 5.2.0 autoloader files generated by xrstf/composer-php52.
  • Added: Preferences that let you manually configure the imported autoload files, and disable searching.

Version 0.1.0 – 2013/05/08

  • Initial release.