1: <?php
2: /**
3: * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
4: * Copyright 2005-2011, Cake Software Foundation, Inc. (https://cakefoundation.org)
5: * Licensed under The MIT License
6: * Redistributions of files must retain the above copyright notice.
7: *
8: * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
9: * @link https://cakephp.org CakePHP(tm) Project
10: * @since 3.6.0
11: * @license https://opensource.org/licenses/mit-license.php MIT License
12: */
13: namespace Cake\Core;
14:
15: /**
16: * Plugin Interface
17: */
18: interface PluginInterface
19: {
20: /**
21: * List of valid hooks.
22: */
23: const VALID_HOOKS = ['routes', 'bootstrap', 'console', 'middleware'];
24:
25: /**
26: * Get the name of this plugin.
27: *
28: * @return string
29: */
30: public function getName();
31:
32: /**
33: * Get the filesystem path to this plugin
34: *
35: * @return string
36: */
37: public function getPath();
38:
39: /**
40: * Get the filesystem path to configuration for this plugin
41: *
42: * @return string
43: */
44: public function getConfigPath();
45:
46: /**
47: * Get the filesystem path to configuration for this plugin
48: *
49: * @return string
50: */
51: public function getClassPath();
52:
53: /**
54: * Load all the application configuration and bootstrap logic.
55: *
56: * The default implementation of this method will include the `config/bootstrap.php` in the plugin if it exist. You
57: * can override this method to replace that behavior.
58: *
59: * The host application is provided as an argument. This allows you to load additional
60: * plugin dependencies, or attach events.
61: *
62: * @param \Cake\Core\PluginApplicationInterface $app The host application
63: * @return void
64: */
65: public function bootstrap(PluginApplicationInterface $app);
66:
67: /**
68: * Add console commands for the plugin.
69: *
70: * @param \Cake\Console\CommandCollection $commands The command collection to update
71: * @return \Cake\Console\CommandCollection
72: */
73: public function console($commands);
74:
75: /**
76: * Add middleware for the plugin.
77: *
78: * @param \Cake\Http\MiddlewareQueue $middleware The middleware queue to update.
79: * @return \Cake\Http\MiddlewareQueue
80: */
81: public function middleware($middleware);
82:
83: /**
84: * Add routes for the plugin.
85: *
86: * The default implementation of this method will include the `config/routes.php` in the plugin if it exists. You
87: * can override this method to replace that behavior.
88: *
89: * @param \Cake\Routing\RouteBuilder $routes The route builder to update.
90: * @return void
91: */
92: public function routes($routes);
93:
94: /**
95: * Disables the named hook
96: *
97: * @param string $hook The hook to disable
98: * @return $this
99: */
100: public function disable($hook);
101:
102: /**
103: * Enables the named hook
104: *
105: * @param string $hook The hook to disable
106: * @return $this
107: */
108: public function enable($hook);
109:
110: /**
111: * Check if the named hook is enabled
112: *
113: * @param string $hook The hook to check
114: * @return bool
115: */
116: public function isEnabled($hook);
117: }
118: