Class Plugin

Plugin is used to load and locate plugins.

It also can retrieve plugin paths and load their bootstrap and routes files.

Namespace: Cake\Core

Properties summary

  • $plugins protected static
    \Cake\Core\PluginCollection|null

    Holds a list of all loaded plugins and their configuration

Method Summary

  • classPath() public static

    Returns the filesystem path for plugin's folder containing class files.

  • configPath() public static

    Returns the filesystem path for plugin's folder containing config files.

  • getCollection() public static

    Get the shared plugin collection.

  • isLoaded() public static

    Returns true if the plugin $plugin is already loaded.

  • loaded() public static

    Return a list of loaded plugins.

  • path() public static

    Returns the filesystem path for a plugin

  • templatePath() public static

    Returns the filesystem path for plugin's folder containing template files.

Method Detail

classPath() public static

classPath(string $name)

Returns the filesystem path for plugin's folder containing class files.

Parameters

string $name

name of the plugin in CamelCase format.

Returns

string

Path to the plugin folder containing class files.

Throws

Cake\Core\Exception\MissingPluginException
If plugin has not been loaded.

configPath() public static

configPath(string $name)

Returns the filesystem path for plugin's folder containing config files.

Parameters

string $name

name of the plugin in CamelCase format.

Returns

string

Path to the plugin folder containing config files.

Throws

Cake\Core\Exception\MissingPluginException
If plugin has not been loaded.

getCollection() public static

getCollection()

Get the shared plugin collection.

This method should generally not be used during application runtime as plugins should be set during Application startup.

Returns

\Cake\Core\PluginCollection

isLoaded() public static

isLoaded(string $plugin)

Returns true if the plugin $plugin is already loaded.

Parameters

string $plugin

Plugin name.

Returns

bool

loaded() public static

loaded()

Return a list of loaded plugins.

Returns

string[]

A list of plugins that have been loaded

path() public static

path(string $name)

Returns the filesystem path for a plugin

Parameters

string $name

name of the plugin in CamelCase format

Returns

string

path to the plugin folder

Throws

Cake\Core\Exception\MissingPluginException
If the folder for plugin was not found or plugin has not been loaded.

templatePath() public static

templatePath(string $name)

Returns the filesystem path for plugin's folder containing template files.

Parameters

string $name

name of the plugin in CamelCase format.

Returns

string

Path to the plugin folder containing template files.

Throws

Cake\Core\Exception\MissingPluginException
If plugin has not been loaded.

Property Detail

$plugins protected static

Holds a list of all loaded plugins and their configuration

Type

\Cake\Core\PluginCollection|null

© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.0/class-Cake.Core.Plugin.html