You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.8KB

  1. <?php
  2. /**
  3. * @link http://www.yiiframework.com/
  4. * @copyright Copyright (c) 2008 Yii Software LLC
  5. * @license http://www.yiiframework.com/license/
  6. */
  7. namespace yii\base;
  8. /**
  9. * BootstrapInterface is the interface that should be implemented by classes who want to participate in the application bootstrap process.
  10. *
  11. * The main method [[bootstrap()]] will be invoked by an application at the beginning of its `init()` method.
  12. *
  13. * Bootstrapping classes can be registered in two approaches.
  14. *
  15. * The first approach is mainly used by extensions and is managed by the Composer installation process.
  16. * You mainly need to list the bootstrapping class of your extension in the `composer.json` file like following,
  17. *
  18. * ```json
  19. * {
  20. * // ...
  21. * "extra": {
  22. * "bootstrap": "path\\to\\MyBootstrapClass"
  23. * }
  24. * }
  25. * ```
  26. *
  27. * If the extension is installed, the bootstrap information will be saved in [[Application::extensions]].
  28. *
  29. * The second approach is used by application code which needs to register some code to be run during
  30. * the bootstrap process. This is done by configuring the [[Application::bootstrap]] property:
  31. *
  32. * ```php
  33. * return [
  34. * // ...
  35. * 'bootstrap' => [
  36. * "path\\to\\MyBootstrapClass1",
  37. * [
  38. * 'class' => "path\\to\\MyBootstrapClass2",
  39. * 'prop1' => 'value1',
  40. * 'prop2' => 'value2',
  41. * ],
  42. * ],
  43. * ];
  44. * ```
  45. *
  46. * As you can see, you can register a bootstrapping class in terms of either a class name or a configuration class.
  47. *
  48. * @author Qiang Xue <qiang.xue@gmail.com>
  49. * @since 2.0
  50. */
  51. interface BootstrapInterface
  52. {
  53. /**
  54. * Bootstrap method to be called during application bootstrap stage.
  55. * @param Application $app the application currently running
  56. */
  57. public function bootstrap($app);
  58. }