当前位置: 首页>>代码示例>>PHP>>正文


PHP Application::after方法代码示例

本文整理汇总了PHP中Illuminate\Foundation\Application::after方法的典型用法代码示例。如果您正苦于以下问题:PHP Application::after方法的具体用法?PHP Application::after怎么用?PHP Application::after使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Foundation\Application的用法示例。


在下文中一共展示了Application::after方法的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));
//.........这里部分代码省略.........
开发者ID:cenwj,项目名称:sns,代码行数:101,代码来源:LaravelDebugBar.php

示例2: 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')) {
//.........这里部分代码省略.........
开发者ID:aaronbullard,项目名称:litmus,代码行数:101,代码来源:LaravelDebugBar.php

示例3: after

 /**
  * Register an "after" application filter.
  *
  * @param \Closure|string $callback
  * @return void 
  * @static 
  */
 public static function after($callback)
 {
     \Illuminate\Foundation\Application::after($callback);
 }
开发者ID:nmkr,项目名称:basic-starter,代码行数:11,代码来源:_ide_helper.php

示例4: registerListeners

 public function registerListeners()
 {
     // Bind the after event.
     $this->app->after([$this, 'executeAfterHook']);
 }
开发者ID:Crinsane,项目名称:anbu,代码行数:5,代码来源:Profiler.php


注:本文中的Illuminate\Foundation\Application::after方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。