本文整理汇总了PHP中Illuminate\Foundation\Application::isBooted方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::isBooted方法的具体用法?PHP Application::isBooted怎么用?PHP Application::isBooted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Foundation\Application
的用法示例。
在下文中一共展示了Application::isBooted方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
/**
* Boot the debugbar (add collectors, renderer and listener)
*/
public function boot()
{
if ($this->booted) {
return;
}
$debugbar = $this;
$app = $this->app;
if ($this->app['config']->get('laravel-debugbar::config.storage.enabled')) {
$path = $this->app['config']->get('laravel-debugbar::config.storage.path');
$storage = new FilesystemStorage($this->app['files'], $path);
$debugbar->setStorage($storage);
}
if ($this->shouldCollect('phpinfo', true)) {
$this->addCollector(new PhpInfoCollector());
}
if ($this->shouldCollect('messages', true)) {
$this->addCollector(new MessagesCollector());
}
if ($this->shouldCollect('time', true)) {
$this->addCollector(new TimeDataCollector());
$this->app->booted(function () use($debugbar) {
if (defined('LARAVEL_START')) {
$debugbar['time']->addMeasure('Booting', LARAVEL_START, microtime(true));
}
});
//Check if App::before is already called..
if (version_compare($app::VERSION, '4.1', '>=') && $this->app->isBooted()) {
$debugbar->startMeasure('application', 'Application');
} else {
$this->app->before(function () use($debugbar) {
$debugbar->startMeasure('application', 'Application');
});
}
$this->app->after(function () use($debugbar) {
$debugbar->stopMeasure('application');
$debugbar->startMeasure('after', 'After application');
});
}
if ($this->shouldCollect('memory', true)) {
$this->addCollector(new MemoryCollector());
}
if ($this->shouldCollect('exceptions', true)) {
try {
$exceptionCollector = new ExceptionsCollector();
if (method_exists($exceptionCollector, 'setChainExceptions')) {
$exceptionCollector->setChainExceptions($this->app['config']->get('laravel-debugbar::config.options.exceptions.chain', true));
}
$this->addCollector($exceptionCollector);
$this->app->error(function (Exception $exception) use($exceptionCollector) {
$exceptionCollector->addException($exception);
});
} catch (\Exception $e) {
}
}
if ($this->shouldCollect('laravel', false)) {
$this->addCollector(new LaravelCollector($this->app));
}
if ($this->shouldCollect('default_request', false)) {
$this->addCollector(new RequestDataCollector());
}
if ($this->shouldCollect('events', false) and isset($this->app['events'])) {
try {
$this->addCollector(new MessagesCollector('events'));
$dispatcher = $this->app['events'];
$dispatcher->listen('*', function () use($debugbar, $dispatcher) {
if (method_exists($dispatcher, 'firing')) {
$event = $dispatcher->firing();
} else {
$args = func_get_args();
$event = end($args);
}
$debugbar['events']->info("Received event: " . $event);
});
} catch (\Exception $e) {
$this->addException(new Exception('Cannot add EventCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
}
}
if ($this->shouldCollect('views', true) and isset($this->app['events'])) {
try {
$collectData = $this->app['config']->get('laravel-debugbar::config.options.views.data', true);
$this->addCollector(new ViewCollector($collectData));
$this->app['events']->listen('composing:*', function ($view) use($debugbar) {
$debugbar['views']->addView($view);
});
} catch (\Exception $e) {
$this->addException(new Exception('Cannot add ViewCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
}
}
if ($this->shouldCollect('route')) {
try {
if (version_compare($app::VERSION, '4.1', '>=')) {
$this->addCollector($this->app->make('Barryvdh\\Debugbar\\DataCollector\\IlluminateRouteCollector'));
} else {
$this->addCollector($this->app->make('Barryvdh\\Debugbar\\DataCollector\\SymfonyRouteCollector'));
}
} catch (\Exception $e) {
$this->addException(new Exception('Cannot add RouteCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
//.........这里部分代码省略.........
示例2: boot
/**
* Boot the debugbar (add collectors, renderer and listener)
*/
public function boot()
{
if ($this->booted) {
return;
}
if ($this->isDebugbarRequest()) {
$this->app['session']->reflash();
}
/** @var \Barryvdh\Debugbar\LaravelDebugbar $debugbar */
$debugbar = $this;
/** @var Application $app */
$app = $this->app;
$this->selectStorage($debugbar);
if ($this->shouldCollect('phpinfo', true)) {
$this->addCollector(new PhpInfoCollector());
}
if ($this->shouldCollect('messages', true)) {
$this->addCollector(new MessagesCollector());
}
if ($this->shouldCollect('time', true)) {
$startTime = defined('LARAVEL_START') ? LARAVEL_START : null;
$this->addCollector(new TimeDataCollector($startTime));
if ($this->isLumen()) {
$debugbar->startMeasure('application', 'Application');
} else {
$this->app->booted(function () use($debugbar, $startTime) {
if ($startTime) {
$debugbar['time']->addMeasure('Booting', $startTime, microtime(true));
}
});
//Check if App::before is already called..
if ($this->app->isBooted()) {
$debugbar->startMeasure('application', 'Application');
} else {
$this->app['router']->before(function () use($debugbar) {
$debugbar->startMeasure('application', 'Application');
});
}
$this->app['router']->after(function () use($debugbar) {
$debugbar->stopMeasure('application');
$debugbar->startMeasure('after', 'After application');
});
}
}
if ($this->shouldCollect('memory', true)) {
$this->addCollector(new MemoryCollector());
}
if ($this->shouldCollect('exceptions', true)) {
try {
$exceptionCollector = new ExceptionsCollector();
$exceptionCollector->setChainExceptions($this->app['config']->get('debugbar.options.exceptions.chain', true));
$this->addCollector($exceptionCollector);
} catch (\Exception $e) {
}
}
if ($this->shouldCollect('laravel', false)) {
$this->addCollector(new LaravelCollector($this->app));
}
if ($this->shouldCollect('default_request', false)) {
$this->addCollector(new RequestDataCollector());
}
if ($this->shouldCollect('events', false) && isset($this->app['events'])) {
try {
$startTime = defined('LARAVEL_START') ? LARAVEL_START : null;
$eventCollector = new EventCollector($startTime);
$this->addCollector($eventCollector);
$this->app['events']->subscribe($eventCollector);
} catch (\Exception $e) {
$this->addException(new Exception('Cannot add EventCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
}
}
if ($this->shouldCollect('views', true) && isset($this->app['events'])) {
try {
$collectData = $this->app['config']->get('debugbar.options.views.data', true);
$this->addCollector(new ViewCollector($collectData));
$this->app['events']->listen('composing:*', function ($view) use($debugbar) {
$debugbar['views']->addView($view);
});
} catch (\Exception $e) {
$this->addException(new Exception('Cannot add ViewCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
}
}
if (!$this->isLumen() && $this->shouldCollect('route')) {
try {
$this->addCollector($this->app->make('Barryvdh\\Debugbar\\DataCollector\\IlluminateRouteCollector'));
} catch (\Exception $e) {
$this->addException(new Exception('Cannot add RouteCollector to Laravel Debugbar: ' . $e->getMessage(), $e->getCode(), $e));
}
}
if (!$this->isLumen() && $this->shouldCollect('log', true)) {
try {
if ($this->hasCollector('messages')) {
$logger = new MessagesCollector('log');
$this['messages']->aggregate($logger);
$this->app['log']->listen(function ($level, $message, $context) use($logger) {
try {
$logMessage = (string) $message;
//.........这里部分代码省略.........
示例3: isBooted
/**
* Determine if the application has booted.
*
* @return bool
* @static
*/
public static function isBooted()
{
return \Illuminate\Foundation\Application::isBooted();
}
示例4: boot
/**
* Boot the debugbar (add collectors, renderer and listener)
*/
public function boot()
{
if ($this->booted) {
return;
}
$debugbar = $this;
$app = $this->app;
if ($this->app['config']->get('laravel-debugbar::config.storage.enabled')) {
$path = $this->app['config']->get('laravel-debugbar::config.storage.path');
$storage = new FilesystemStorage($this->app['files'], $path);
$debugbar->setStorage($storage);
}
if ($this->shouldCollect('phpinfo', true)) {
$this->addCollector(new PhpInfoCollector());
}
if ($this->shouldCollect('messages', true)) {
$this->addCollector(new MessagesCollector());
}
if ($this->shouldCollect('time', true)) {
$this->addCollector(new TimeDataCollector());
$this->app->booted(function () use($debugbar) {
if (defined('LARAVEL_START')) {
$debugbar['time']->addMeasure('Booting', LARAVEL_START, microtime(true));
}
});
//Check if App::before is already called..
if (version_compare($app::VERSION, '4.1', '>=') && $this->app->isBooted()) {
$debugbar->startMeasure('application', 'Application');
} else {
$this->app->before(function () use($debugbar) {
$debugbar->startMeasure('application', 'Application');
});
}
$this->app->after(function () use($debugbar) {
$debugbar->stopMeasure('application');
$debugbar->startMeasure('after', 'After application');
});
}
if ($this->shouldCollect('memory', true)) {
$this->addCollector(new MemoryCollector());
}
if ($this->shouldCollect('exceptions', true)) {
$this->addCollector(new ExceptionsCollector());
}
if ($this->shouldCollect('laravel', false)) {
$this->addCollector(new LaravelCollector());
}
if ($this->shouldCollect('default_request', false)) {
$this->addCollector(new RequestDataCollector());
}
if ($this->shouldCollect('events', false) and isset($this->app['events'])) {
$this->addCollector(new MessagesCollector('events'));
$dispatcher = $this->app['events'];
$dispatcher->listen('*', function () use($debugbar, $dispatcher) {
if (method_exists($dispatcher, 'firing')) {
$event = $dispatcher->firing();
} else {
$args = func_get_args();
$event = end($args);
}
$debugbar['events']->info("Received event: " . $event);
});
}
if ($this->shouldCollect('views', true) and isset($this->app['events'])) {
$collectData = $this->app['config']->get('laravel-debugbar::config.options.views.data', true);
$this->addCollector(new ViewCollector($collectData));
$this->app['events']->listen('composing:*', function ($view) use($debugbar) {
$debugbar['views']->addView($view);
});
}
if ($this->shouldCollect('route')) {
if (version_compare($app::VERSION, '4.1', '>=')) {
$this->addCollector($this->app->make('Barryvdh\\Debugbar\\DataCollector\\IlluminateRouteCollector'));
} else {
$this->addCollector($this->app->make('Barryvdh\\Debugbar\\DataCollector\\SymfonyRouteCollector'));
}
}
if ($this->shouldCollect('log', true)) {
if ($this->hasCollector('messages')) {
$logger = new MessagesCollector('log');
$this['messages']->aggregate($logger);
$this->app['log']->listen(function ($level, $message, $context) use($logger) {
if (is_array($message) or is_object($message)) {
$message = json_encode($message);
}
$log = '[' . date('H:i:s') . '] ' . "LOG.{$level}: " . $message . (!empty($context) ? ' ' . json_encode($context) : '');
$logger->addMessage($log, $level);
});
} else {
$this->addCollector(new MonologCollector($this->app['log']->getMonolog()));
}
}
if ($this->shouldCollect('db', true) and isset($this->app['db'])) {
try {
$pdo = new TraceablePDO($this->app['db']->getPdo());
$pdoCollector = new PDOCollector($pdo);
if ($this->app['config']->get('laravel-debugbar::config.options.pdo.with_params')) {
//.........这里部分代码省略.........