PluginApplicationInterface.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * For full copyright and license information, please see the LICENSE.txt
  8. * Redistributions of files must retain the above copyright notice.
  9. *
  10. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  11. * @link https://cakephp.org CakePHP(tm) Project
  12. * @since 3.6.0
  13. * @license https://opensource.org/licenses/mit-license.php MIT License
  14. */
  15. namespace Cake\Core;
  16. use Cake\Event\EventDispatcherInterface;
  17. use Cake\Event\EventManagerInterface;
  18. /**
  19. * Interface for Applications that leverage plugins & events.
  20. *
  21. * Events can be bound to the application event manager during
  22. * the application's bootstrap and plugin bootstrap.
  23. */
  24. interface PluginApplicationInterface extends EventDispatcherInterface
  25. {
  26. /**
  27. * Add a plugin to the loaded plugin set.
  28. *
  29. * @param string|\Cake\Core\PluginInterface $name The plugin name or plugin object.
  30. * @param array $config The configuration data for the plugin if using a string for $name
  31. * @return $this
  32. */
  33. public function addPlugin($name, array $config = []);
  34. /**
  35. * Run bootstrap logic for loaded plugins.
  36. *
  37. * @return void
  38. */
  39. public function pluginBootstrap();
  40. /**
  41. * Run routes hooks for loaded plugins
  42. *
  43. * @param \Cake\Routing\RouteBuilder $routes The route builder to use.
  44. * @return \Cake\Routing\RouteBuilder
  45. */
  46. public function pluginRoutes($routes);
  47. /**
  48. * Run middleware hooks for plugins
  49. *
  50. * @param \Cake\Http\MiddlewareQueue $middleware The MiddlewareQueue to use.
  51. * @return \Cake\Http\MiddlewareQueue
  52. */
  53. public function pluginMiddleware($middleware);
  54. /**
  55. * Run console hooks for plugins
  56. *
  57. * @param \Cake\Console\CommandCollection $commands The CommandCollection to use.
  58. * @return \Cake\Console\CommandCollection
  59. */
  60. public function pluginConsole($commands);
  61. }