W3cubDocs

/CakePHP 4.4

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
Link: https://book.cakephp.org/4/en/plugins.html

Property 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): string

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

Parameters

string $name

name of the plugin in CamelCase format.

Returns

string

Throws

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

configPath() public static

configPath(string $name): string

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

Parameters

string $name

name of the plugin in CamelCase format.

Returns

string

Throws

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

getCollection() public static

getCollection(): Cake\Core\PluginCollection

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): bool

Returns true if the plugin $plugin is already loaded.

Parameters

string $plugin

Plugin name.

Returns

bool

loaded() public static

loaded(): array<string>

Return a list of loaded plugins.

Returns

array<string>

path() public static

path(string $name): string

Returns the filesystem path for a plugin

Parameters

string $name

name of the plugin in CamelCase format

Returns

string

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): string

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

Parameters

string $name

name of the plugin in CamelCase format.

Returns

string

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.4/class-Cake.Core.Plugin.html