« Yaf_Application::setAppDirectory
Yaf_Dispatcher »

Yaf_Bootstrap_Abstract クラス

(No version information available, might only be in Git)

はじめに

ブートストラップとは、アプリケーションを実行する前の初期設定に使う仕組みのことです。

ユーザーが自前のブートストラップクラスを定義するには、 Yaf_Bootstrap_Abstract を継承します。

ブートストラップクラスで定義したメソッドの中で "_init" で始まるものがすべて、定義した順に Yaf_Application::bootstrap() から呼ばれます。

例

例1 ブートストラップの例

<?php
   /* ブートストラップクラスは ./application/Bootstrap.php で定義しないといけません */
   class Bootstrap extends Yaf_Bootstrap_Abstract {
        public function _initConfig(Yaf_Dispatcher $dispatcher) {
            var_dump(__METHOD__);
        }
        public function _initPlugin(Yaf_Dispatcher $dispatcher) {
            var_dump(__METHOD__);
        }
   }

   $config = array(
       "application" => array(
           "directory" => dirname(__FILE__) . "/application/",
       ),
   );
 
   $app = new Yaf_Application($config);
   $app->bootstrap();
?>

上の例の出力は、 たとえば以下のようになります。

string(22) "Bootstrap::_initConfig"
string(22) "Bootstrap::_initPlugin"

クラス概要

abstract class Yaf_Bootstrap_Abstract {
/* プロパティ */
/* メソッド */
}
関連キーワード:
Bootstrap   Abstract   ブートストラップ   Application   Dispatcher   application   bootstrap   initConfig   dispatcher   dump   initPlugin   config   setAppDirectory   information   available   アプリケーション   初期設定   仕組み   自前   継承   init   extends   directory   dirname   概要
関連する関数・ページ:
yaf-application.bootstrap   yaf-dispatcher.registerplugin   yaf-application.setappdirectory   class.yaf-application   yaf-application.construct   yaf-router.getcurrentroute