The PluginClassLocator interface

Overview

The PluginClassLocator interface describes a component capable of maintaining an internal map of plugin names to actual class names. Classes implementing this interface can register and unregister plugin/class associations, and return the entire map.

Quick Start

Classes implementing the PluginClassLocator need to implement only three methods, as illustrated below.

1
2
3
4
5
6
7
8
namespace Zend\Loader;

interface PluginClassLocator
{
    public function registerPlugin($shortName, $className);
    public function unregisterPlugin($shortName);
    public function getRegisteredPlugins();
}

Configuration Options

This component defines no configuration options, as it is an interface.

Available Methods

registerPlugin

Register a mapping of plugin name to class name registerPlugin($shortName, $className)

registerPlugin() Implement this method to add or overwrite plugin name/class name associations in the internal plugin map. $shortName will be aliased to $className.

unregisterPlugin

Remove a plugin/class name association unregisterPlugin($shortName)

unregisterPlugin() Implement this to allow removing an existing plugin mapping corresponding to $shortName.

getRegisteredPlugins

Retrieve the map of plugin name/class name associations getRegisteredPlugins()

getRegisteredPlugins() Implement this to allow returning the plugin name/class name map.

Examples

Please see the Quick Start for the interface specification.

Table Of Contents

Previous topic

The ShortNameLocator Interface

Next topic

The Class Map Generator utility: bin/classmap_generator.php

This Page

Note: You need to stay logged into your GitHub account to contribute to the documentation.

Edit this document

Edit this document

The source code of this file is hosted on GitHub. Everyone can update and fix errors in this document with few clicks - no downloads needed.

  1. Login with your GitHub account.
  2. Go to The PluginClassLocator interface on GitHub.
  3. Edit file contents using GitHub's text editor in your web browser
  4. Fill in the Commit message text box at the end of the page telling why you did the changes. Press Propose file change button next to it when done.
  5. On Send a pull request page you don't need to fill in text anymore. Just press Send pull request button.
  6. Your changes are now queued for review under project's Pull requests tab on GitHub.