CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.10 Red Velvet API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 3.10
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • Auth
    • Cache
    • Collection
    • Command
    • Console
    • Controller
    • Core
      • Configure
      • Exception
      • Retry
    • Database
    • Datasource
    • Error
    • Event
    • Filesystem
    • Form
    • Http
    • I18n
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • Shell
    • TestSuite
    • Utility
    • Validation
    • View

Class BasePlugin

Base Plugin Class

Every plugin should extends from this class or implement the interfaces and include a plugin class in it's src root folder.

Namespace: Cake\Core

Constants

  • string[]
    VALID_HOOKS ¶
    ['routes', 'bootstrap', 'console', 'middleware']

    List of valid hooks.

Property Summary

  • $bootstrapEnabled protected
    bool

    Do bootstrapping or not

  • $classPath protected
    string

    The class path for this plugin.

  • $configPath protected
    string

    The config path for this plugin.

  • $consoleEnabled protected
    bool

    Console middleware

  • $middlewareEnabled protected
    bool

    Enable middleware

  • $name protected
    string

    The name of this plugin

  • $path protected
    string

    The path to this plugin.

  • $routesEnabled protected
    bool

    Load routes or not

Method Summary

  • __construct() public

    Constructor

  • bootstrap() public

    Load all the application configuration and bootstrap logic.

  • checkHook() protected

    Check if a hook name is valid

  • console() public

    Add console commands for the plugin.

  • disable() public

    Disables the named hook

  • enable() public

    Enables the named hook

  • getClassPath() public

    Get the filesystem path to configuration for this plugin

  • getConfigPath() public

    Get the filesystem path to configuration for this plugin

  • getName() public

    Get the name of this plugin.

  • getPath() public

    Get the filesystem path to this plugin

  • initialize() public

    {@inheritdoc}

  • isEnabled() public

    Check if the named hook is enabled

  • middleware() public

    Add middleware for the plugin.

  • routes() public

    Add routes for the plugin.

Method Detail

__construct() ¶ public

__construct(array $options = [])

Constructor

Parameters
array $options optional

Options

bootstrap() ¶ public

bootstrap(Cake\Core\PluginApplicationInterface $app): void

Load all the application configuration and bootstrap logic.

The default implementation of this method will include the config/bootstrap.php in the plugin if it exist. You can override this method to replace that behavior.

The host application is provided as an argument. This allows you to load additional plugin dependencies, or attach events.

Parameters
Cake\Core\PluginApplicationInterface $app
Returns
void

checkHook() ¶ protected

checkHook(string $hook): void

Check if a hook name is valid

Parameters
string $hook

The hook name to check

Returns
void
Throws
InvalidArgumentException
on invalid hooks

console() ¶ public

console(Cake\Console\CommandCollection $commands): Cake\Console\CommandCollection

Add console commands for the plugin.

Parameters
Cake\Console\CommandCollection $commands
Returns
Cake\Console\CommandCollection

disable() ¶ public

disable(string $hook): $this

Disables the named hook

Parameters
string $hook
Returns
$this

enable() ¶ public

enable(string $hook): $this

Enables the named hook

Parameters
string $hook
Returns
$this

getClassPath() ¶ public

getClassPath(): string

Get the filesystem path to configuration for this plugin

Returns
string

getConfigPath() ¶ public

getConfigPath(): string

Get the filesystem path to configuration for this plugin

Returns
string

getName() ¶ public

getName(): string

Get the name of this plugin.

Returns
string

getPath() ¶ public

getPath(): string

Get the filesystem path to this plugin

Returns
string

initialize() ¶ public

initialize()

{@inheritdoc}

isEnabled() ¶ public

isEnabled(string $hook): bool

Check if the named hook is enabled

Parameters
string $hook
Returns
bool

middleware() ¶ public

middleware(Cake\Http\MiddlewareQueue $middleware): Cake\Http\MiddlewareQueue

Add middleware for the plugin.

Parameters
Cake\Http\MiddlewareQueue $middleware
Returns
Cake\Http\MiddlewareQueue

routes() ¶ public

routes(Cake\Routing\RouteBuilder $routes): void

Add routes for the plugin.

The default implementation of this method will include the config/routes.php in the plugin if it exists. You can override this method to replace that behavior.

Parameters
Cake\Routing\RouteBuilder $routes
Returns
void

Property Detail

$bootstrapEnabled ¶ protected

Do bootstrapping or not

Type
bool

$classPath ¶ protected

The class path for this plugin.

Type
string

$configPath ¶ protected

The config path for this plugin.

Type
string

$consoleEnabled ¶ protected

Console middleware

Type
bool

$middlewareEnabled ¶ protected

Enable middleware

Type
bool

$name ¶ protected

The name of this plugin

Type
string

$path ¶ protected

The path to this plugin.

Type
string

$routesEnabled ¶ protected

Load routes or not

Type
bool
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs