Laravel 5.6 updates
Travis config update Removed HHVM script as Laravel no longer support HHVM after releasing 5.3
This commit is contained in:
4
vendor/barryvdh/laravel-debugbar/LICENSE
vendored
4
vendor/barryvdh/laravel-debugbar/LICENSE
vendored
@@ -1,4 +1,4 @@
|
||||
Copyright (C) 2013-2014 Barry vd. Heuvel
|
||||
Copyright (C) 2013-present Barry vd. Heuvel
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -16,4 +16,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
||||
|
29
vendor/barryvdh/laravel-debugbar/composer.json
vendored
29
vendor/barryvdh/laravel-debugbar/composer.json
vendored
@@ -10,10 +10,13 @@
|
||||
}
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.5.9",
|
||||
"illuminate/support": "5.1.*|5.2.*|5.3.*|5.4.*|5.5.*",
|
||||
"symfony/finder": "~2.7|~3.0",
|
||||
"maximebf/debugbar": "~1.13.0"
|
||||
"php": ">=7.0",
|
||||
"maximebf/debugbar": "~1.15.0",
|
||||
"illuminate/routing": "5.5.x|5.6.x",
|
||||
"illuminate/session": "5.5.x|5.6.x",
|
||||
"illuminate/support": "5.5.x|5.6.x",
|
||||
"symfony/debug": "^3|^4",
|
||||
"symfony/finder": "^3|^4"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
@@ -22,5 +25,23 @@
|
||||
"files": [
|
||||
"src/helpers.php"
|
||||
]
|
||||
},
|
||||
"minimum-stability": "dev",
|
||||
"prefer-stable": true,
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.2-dev"
|
||||
},
|
||||
"laravel": {
|
||||
"providers": [
|
||||
"Barryvdh\\Debugbar\\ServiceProvider"
|
||||
],
|
||||
"aliases": {
|
||||
"Debugbar": "Barryvdh\\Debugbar\\Facade"
|
||||
}
|
||||
}
|
||||
},
|
||||
"require-dev": {
|
||||
"illuminate/framework": "5.5.x"
|
||||
}
|
||||
}
|
||||
|
@@ -9,10 +9,15 @@ return [
|
||||
|
|
||||
| Debugbar is enabled by default, when debug is set to true in app.php.
|
||||
| You can override the value by setting enable to true or false instead of null.
|
||||
|
|
||||
| You can provide an array of URI's that must be ignored (eg. 'api/*')
|
||||
|
|
||||
*/
|
||||
|
||||
'enabled' => env('DEBUGBAR_ENABLED', null),
|
||||
'except' => [
|
||||
//
|
||||
],
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -116,6 +121,7 @@ return [
|
||||
'logs' => false, // Add the latest log messages
|
||||
'files' => false, // Show the included files
|
||||
'config' => false, // Display config settings
|
||||
'cache' => false, // Display cache events
|
||||
],
|
||||
|
||||
/*
|
||||
@@ -153,6 +159,9 @@ return [
|
||||
'logs' => [
|
||||
'file' => null
|
||||
],
|
||||
'cache' => [
|
||||
'values' => true // collect cache values
|
||||
],
|
||||
],
|
||||
|
||||
/*
|
||||
|
19
vendor/barryvdh/laravel-debugbar/readme.md
vendored
19
vendor/barryvdh/laravel-debugbar/readme.md
vendored
@@ -3,7 +3,9 @@
|
||||
[](https://packagist.org/packages/barryvdh/laravel-debugbar)
|
||||
[](https://packagist.org/packages/barryvdh/laravel-debugbar)
|
||||
|
||||
### For Laravel 4, please use the [1.8 branch](https://github.com/barryvdh/laravel-debugbar/tree/1.8)!
|
||||
### Note for v3: Debugbar is now enabled by requiring the package, but still needs APP_DEBUG=true by default!
|
||||
|
||||
### For Laravel < 5.5, please use the [2.4 branch](https://github.com/barryvdh/laravel-debugbar/tree/2.4)!
|
||||
|
||||
This is a package to integrate [PHP Debug Bar](http://phpdebugbar.com/) with Laravel 5.
|
||||
It includes a ServiceProvider to register the debugbar and attach it to the output. You can publish assets and configure it through Laravel.
|
||||
@@ -25,6 +27,7 @@ This package includes some custom collectors:
|
||||
- LogsCollector: Show the latest log entries from the storage logs. (disabled by default)
|
||||
- FilesCollector: Show the files that are included/required by PHP. (disabled by default)
|
||||
- ConfigCollector: Display the values from the config files. (disabled by default)
|
||||
- CacheCollector: Display all cache events. (disabled by default)
|
||||
|
||||
Bootstraps the following collectors for Laravel:
|
||||
- LogCollector: Show all Log messages
|
||||
@@ -41,17 +44,21 @@ It also provides a Facade interface for easy logging Messages, Exceptions and Ti
|
||||
|
||||
## Installation
|
||||
|
||||
Require this package with composer:
|
||||
Require this package with composer. It is recommended to only require the package for development.
|
||||
|
||||
```shell
|
||||
composer require barryvdh/laravel-debugbar
|
||||
composer require barryvdh/laravel-debugbar --dev
|
||||
```
|
||||
|
||||
After updating composer, add the ServiceProvider to the providers array in config/app.php
|
||||
Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
|
||||
|
||||
The Debugbar will be enabled when `APP_DEBUG` is `true`.
|
||||
|
||||
> If you use a catch-all/fallback route, make sure you load the Debugbar ServiceProvider before your own App ServiceProviders.
|
||||
|
||||
### Laravel 5.x:
|
||||
### Laravel 5.5+:
|
||||
|
||||
If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php
|
||||
|
||||
```php
|
||||
Barryvdh\Debugbar\ServiceProvider::class,
|
||||
@@ -63,7 +70,7 @@ If you want to use the facade to log messages, add this to your facades in app.p
|
||||
'Debugbar' => Barryvdh\Debugbar\Facade::class,
|
||||
```
|
||||
|
||||
The profiler is enabled by default, if you have app.debug=true. You can override that in the config (`debugbar.enabled`). See more options in `config/debugbar.php`
|
||||
The profiler is enabled by default, if you have APP_DEBUG=true. You can override that in the config (`debugbar.enabled`) or by setting `DEBUGBAR_ENABLED` in your `.env`. See more options in `config/debugbar.php`
|
||||
You can also set in your config if you want to include/exclude the vendor files also (FontAwesome, Highlight.js and jQuery). If you already use them in your site, set it to false.
|
||||
You can also only display the js or css vendors, by setting it to 'js' or 'css'. (Highlight.js requires both css + js, so set to `true` for syntax highlighting)
|
||||
|
||||
|
@@ -16,7 +16,7 @@ class ClearCommand extends Command
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function fire()
|
||||
public function handle()
|
||||
{
|
||||
$this->debugbar->boot();
|
||||
|
||||
|
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
namespace Barryvdh\Debugbar\Console;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Publish the Debugbar assets to the public directory
|
||||
*
|
||||
* @author Barry vd. Heuvel <barryvdh@gmail.com>
|
||||
* @deprecated No longer needed because of the AssetController
|
||||
*/
|
||||
class PublishCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The console command name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $name = 'debugbar:publish';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Publish the Debugbar assets';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function fire()
|
||||
{
|
||||
$this->info(
|
||||
'NOTICE: Since laravel-debugbar 1.7.x, publishing assets is no longer necessary. The assets in public/packages/barryvdh/laravel-debugbar and maximebf/php-debugbar can be safely removed.'
|
||||
);
|
||||
}
|
||||
}
|
@@ -35,4 +35,4 @@ if (class_exists('Illuminate\Routing\Controller')) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
27
vendor/barryvdh/laravel-debugbar/src/Controllers/CacheController.php
vendored
Normal file
27
vendor/barryvdh/laravel-debugbar/src/Controllers/CacheController.php
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php namespace Barryvdh\Debugbar\Controllers;
|
||||
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class CacheController extends BaseController
|
||||
{
|
||||
/**
|
||||
* Forget a cache key
|
||||
*
|
||||
*/
|
||||
public function delete($key, $tags = '')
|
||||
{
|
||||
$cache = app('cache');
|
||||
|
||||
if (!empty($tags)) {
|
||||
$tags = json_decode($tags, true);
|
||||
$cache = $cache->tags($tags);
|
||||
} else {
|
||||
unset($tags);
|
||||
}
|
||||
|
||||
$success = $cache->forget($key);
|
||||
|
||||
return response()->json(compact('success'));
|
||||
}
|
||||
|
||||
}
|
@@ -6,17 +6,10 @@ use Illuminate\Http\Response;
|
||||
|
||||
class OpenHandlerController extends BaseController
|
||||
{
|
||||
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$debugbar = $this->debugbar;
|
||||
|
||||
if (!$debugbar->isEnabled()) {
|
||||
$this->app->abort('500', 'Debugbar is not enabled');
|
||||
}
|
||||
|
||||
$openHandler = new OpenHandler($debugbar);
|
||||
|
||||
$openHandler = new OpenHandler($this->debugbar);
|
||||
$data = $openHandler->handle(null, false, false);
|
||||
|
||||
return new Response(
|
||||
@@ -40,14 +33,7 @@ class OpenHandlerController extends BaseController
|
||||
'id' => $id,
|
||||
];
|
||||
|
||||
$debugbar = $this->debugbar;
|
||||
|
||||
if (!$debugbar->isEnabled()) {
|
||||
$this->app->abort('500', 'Debugbar is not enabled');
|
||||
}
|
||||
|
||||
$openHandler = new OpenHandler($debugbar);
|
||||
|
||||
$openHandler = new OpenHandler($this->debugbar);
|
||||
$data = $openHandler->handle($request, false, false);
|
||||
|
||||
// Convert to Clockwork
|
||||
|
@@ -1,115 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Barryvdh\Debugbar\DataCollector;
|
||||
|
||||
use DebugBar\DataCollector\DataCollector;
|
||||
use DebugBar\DataCollector\Renderable;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
|
||||
/**
|
||||
* Collector for Laravel's Auth provider
|
||||
*/
|
||||
class AuthCollector extends DataCollector implements Renderable
|
||||
{
|
||||
/** @var \Illuminate\Auth\AuthManager */
|
||||
protected $auth;
|
||||
/** @var bool */
|
||||
protected $showName = false;
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Auth\AuthManager $auth
|
||||
*/
|
||||
public function __construct($auth)
|
||||
{
|
||||
$this->auth = $auth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to show the users name/email
|
||||
* @param bool $showName
|
||||
*/
|
||||
public function setShowName($showName)
|
||||
{
|
||||
$this->showName = (bool) $showName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @{inheritDoc}
|
||||
*/
|
||||
public function collect()
|
||||
{
|
||||
try {
|
||||
$user = $this->auth->user();
|
||||
} catch (\Exception $e) {
|
||||
$user = null;
|
||||
}
|
||||
return $this->getUserInformation($user);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get displayed user information
|
||||
* @param \Illuminate\Auth\UserInterface $user
|
||||
* @return array
|
||||
*/
|
||||
protected function getUserInformation($user = null)
|
||||
{
|
||||
// Defaults
|
||||
if (is_null($user)) {
|
||||
return [
|
||||
'name' => 'Guest',
|
||||
'user' => ['guest' => true],
|
||||
];
|
||||
}
|
||||
|
||||
// The default auth identifer is the ID number, which isn't all that
|
||||
// useful. Try username and email.
|
||||
$identifier = $user->getAuthIdentifier();
|
||||
if (is_numeric($identifier)) {
|
||||
try {
|
||||
if ($user->username) {
|
||||
$identifier = $user->username;
|
||||
} elseif ($user->email) {
|
||||
$identifier = $user->email;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => $identifier,
|
||||
'user' => $user instanceof Arrayable ? $user->toArray() : $user,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @{inheritDoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'auth';
|
||||
}
|
||||
|
||||
/**
|
||||
* @{inheritDoc}
|
||||
*/
|
||||
public function getWidgets()
|
||||
{
|
||||
$widgets = [
|
||||
'auth' => [
|
||||
'icon' => 'lock',
|
||||
'widget' => 'PhpDebugBar.Widgets.VariableListWidget',
|
||||
'map' => 'auth.user',
|
||||
'default' => '{}'
|
||||
]
|
||||
];
|
||||
if ($this->showName) {
|
||||
$widgets['auth.name'] = [
|
||||
'icon' => 'user',
|
||||
'tooltip' => 'Auth status',
|
||||
'map' => 'auth.name',
|
||||
'default' => '',
|
||||
];
|
||||
}
|
||||
return $widgets;
|
||||
}
|
||||
}
|
95
vendor/barryvdh/laravel-debugbar/src/DataCollector/CacheCollector.php
vendored
Normal file
95
vendor/barryvdh/laravel-debugbar/src/DataCollector/CacheCollector.php
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
namespace Barryvdh\Debugbar\DataCollector;
|
||||
|
||||
use DebugBar\DataCollector\TimeDataCollector;
|
||||
use Illuminate\Cache\Events\CacheEvent;
|
||||
use Illuminate\Cache\Events\CacheHit;
|
||||
use Illuminate\Cache\Events\CacheMissed;
|
||||
use Illuminate\Cache\Events\KeyForgotten;
|
||||
use Illuminate\Cache\Events\KeyWritten;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
|
||||
class CacheCollector extends TimeDataCollector
|
||||
{
|
||||
/** @var bool */
|
||||
protected $collectValues;
|
||||
|
||||
/** @var array */
|
||||
protected $classMap = [
|
||||
CacheHit::class => 'hit',
|
||||
CacheMissed::class => 'missed',
|
||||
KeyWritten::class => 'written',
|
||||
KeyForgotten::class => 'forgotten',
|
||||
];
|
||||
|
||||
public function __construct($requestStartTime = null, $collectValues)
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->collectValues = $collectValues;
|
||||
}
|
||||
|
||||
public function onCacheEvent(CacheEvent $event)
|
||||
{
|
||||
$class = get_class($event);
|
||||
$params = get_object_vars($event);
|
||||
|
||||
$label = $this->classMap[$class];
|
||||
|
||||
if (isset($params['value'])) {
|
||||
if ($this->collectValues) {
|
||||
$params['value'] = htmlspecialchars($this->getDataFormatter()->formatVar($event->value));
|
||||
} else {
|
||||
unset($params['value']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!empty($params['key']) && in_array($label, ['hit', 'written'])) {
|
||||
$params['delete'] = route('debugbar.cache.delete', [
|
||||
'key' => urlencode($params['key']),
|
||||
'tags' => !empty($params['tags']) ? json_encode($params['tags']) : '',
|
||||
]);
|
||||
}
|
||||
|
||||
$time = microtime(true);
|
||||
$this->addMeasure($label . "\t" . $event->key, $time, $time, $params);
|
||||
}
|
||||
|
||||
|
||||
public function subscribe(Dispatcher $dispatcher)
|
||||
{
|
||||
foreach ($this->classMap as $eventClass => $type) {
|
||||
$dispatcher->listen($eventClass, [$this, 'onCacheEvent']);
|
||||
}
|
||||
}
|
||||
|
||||
public function collect()
|
||||
{
|
||||
$data = parent::collect();
|
||||
$data['nb_measures'] = count($data['measures']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'cache';
|
||||
}
|
||||
|
||||
public function getWidgets()
|
||||
{
|
||||
return [
|
||||
'cache' => [
|
||||
'icon' => 'clipboard',
|
||||
'widget' => 'PhpDebugBar.Widgets.LaravelCacheWidget',
|
||||
'map' => 'cache',
|
||||
'default' => '{}',
|
||||
],
|
||||
'cache:badge' => [
|
||||
'map' => 'cache.nb_measures',
|
||||
'default' => 'null',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
@@ -1,36 +1,25 @@
|
||||
<?php
|
||||
namespace Barryvdh\Debugbar\DataCollector;
|
||||
|
||||
use Barryvdh\Debugbar\DataFormatter\SimpleFormatter;
|
||||
use DebugBar\DataCollector\TimeDataCollector;
|
||||
use Illuminate\Events\Dispatcher;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
|
||||
class EventCollector extends TimeDataCollector
|
||||
{
|
||||
/** @var Dispatcher */
|
||||
protected $events;
|
||||
|
||||
/** @var ValueExporter */
|
||||
protected $exporter;
|
||||
|
||||
public function __construct($requestStartTime = null)
|
||||
{
|
||||
parent::__construct($requestStartTime);
|
||||
|
||||
$this->exporter = new ValueExporter();
|
||||
$this->setDataFormatter(new SimpleFormatter());
|
||||
}
|
||||
|
||||
public function onWildcardEvent($name = null, $data = [])
|
||||
{
|
||||
// Pre-Laravel 5.4, using 'firing' to get the current event name.
|
||||
if (method_exists($this->events, 'firing')) {
|
||||
$name = $this->events->firing();
|
||||
|
||||
// Get the arguments passed to the event
|
||||
$data = func_get_args();
|
||||
}
|
||||
|
||||
$params = $this->prepareParams($data);
|
||||
$time = microtime(true);
|
||||
|
||||
@@ -63,7 +52,7 @@ class EventCollector extends TimeDataCollector
|
||||
$listener = $reflector->getName() . ' (' . $filename . ':' . $reflector->getStartLine() . '-' . $reflector->getEndLine() . ')';
|
||||
} else {
|
||||
// Not sure if this is possible, but to prevent edge cases
|
||||
$listener = $this->formatVar($listener);
|
||||
$listener = $this->getDataFormatter()->formatVar($listener);
|
||||
}
|
||||
|
||||
$params['listeners.' . $i] = $listener;
|
||||
@@ -84,7 +73,7 @@ class EventCollector extends TimeDataCollector
|
||||
if (is_object($value) && Str::is('Illuminate\*\Events\*', get_class($value))) {
|
||||
$value = $this->prepareParams(get_object_vars($value));
|
||||
}
|
||||
$data[$key] = htmlentities($this->exporter->exportValue($value), ENT_QUOTES, 'UTF-8', false);
|
||||
$data[$key] = htmlentities($this->getDataFormatter()->formatVar($value), ENT_QUOTES, 'UTF-8', false);
|
||||
}
|
||||
|
||||
return $data;
|
||||
|
@@ -4,18 +4,18 @@ namespace Barryvdh\Debugbar\DataCollector;
|
||||
|
||||
use DebugBar\DataCollector\DataCollector;
|
||||
use DebugBar\DataCollector\Renderable;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Container\Container;
|
||||
|
||||
class FilesCollector extends DataCollector implements Renderable
|
||||
{
|
||||
/** @var \Illuminate\Contracts\Foundation\Application */
|
||||
/** @var \Illuminate\Container\Container */
|
||||
protected $app;
|
||||
protected $basePath;
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Contracts\Foundation\Application $app
|
||||
* @param \Illuminate\Container\Container $app
|
||||
*/
|
||||
public function __construct(Application $app = null)
|
||||
public function __construct(Container $app = null)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->basePath = base_path();
|
||||
|
@@ -2,40 +2,45 @@
|
||||
|
||||
namespace Barryvdh\Debugbar\DataCollector;
|
||||
|
||||
use Barryvdh\Debugbar\DataFormatter\SimpleFormatter;
|
||||
use DebugBar\DataCollector\MessagesCollector;
|
||||
use Illuminate\Contracts\Auth\Access\Gate;
|
||||
use Illuminate\Contracts\Auth\Access\Authorizable;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
|
||||
/**
|
||||
* Collector for Laravel's Auth provider
|
||||
*/
|
||||
class GateCollector extends MessagesCollector
|
||||
{
|
||||
/** @var ValueExporter */
|
||||
protected $exporter;
|
||||
/**
|
||||
* @param Gate $gate
|
||||
*/
|
||||
public function __construct(Gate $gate)
|
||||
{
|
||||
parent::__construct('gate');
|
||||
$this->exporter = new ValueExporter();
|
||||
|
||||
if (method_exists($gate, 'after')) {
|
||||
$gate->after([$this, 'addCheck']);
|
||||
}
|
||||
$this->setDataFormatter(new SimpleFormatter());
|
||||
$gate->after([$this, 'addCheck']);
|
||||
}
|
||||
|
||||
public function addCheck(Authenticatable $user, $ability, $result, $arguments = [])
|
||||
public function addCheck(Authorizable $user = null, $ability, $result, $arguments = [])
|
||||
{
|
||||
$userKey = 'user';
|
||||
$userId = null;
|
||||
|
||||
if ($user) {
|
||||
$userKey = snake_case(class_basename($user));
|
||||
$userId = $user instanceof Authenticatable ? $user->getAuthIdentifier() : $user->id;
|
||||
}
|
||||
|
||||
$label = $result ? 'success' : 'error';
|
||||
|
||||
$this->addMessage([
|
||||
'ability' => $ability,
|
||||
'result' => $result,
|
||||
'user' => $user->getAuthIdentifier(),
|
||||
'arguments' => $this->exporter->exportValue($arguments),
|
||||
$userKey => $userId,
|
||||
'arguments' => $this->getDataFormatter()->formatVar($arguments),
|
||||
], $label, false);
|
||||
}
|
||||
}
|
||||
|
@@ -2,28 +2,45 @@
|
||||
|
||||
namespace Barryvdh\Debugbar\DataCollector;
|
||||
|
||||
use DebugBar\DataCollector\DataCollector;
|
||||
use DebugBar\DataCollector\Renderable;
|
||||
use Illuminate\Auth\SessionGuard;
|
||||
use Illuminate\Contracts\Auth\Guard;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
|
||||
|
||||
/**
|
||||
* Collector for Laravel's Auth provider
|
||||
*/
|
||||
class MultiAuthCollector extends AuthCollector
|
||||
class MultiAuthCollector extends DataCollector implements Renderable
|
||||
{
|
||||
/** @var array $guards */
|
||||
protected $guards;
|
||||
|
||||
/** @var \Illuminate\Auth\AuthManager */
|
||||
protected $auth;
|
||||
/** @var bool */
|
||||
protected $showName = false;
|
||||
|
||||
/**
|
||||
* @param \Illuminate\Auth\AuthManager $auth
|
||||
* @param array $guards
|
||||
*/
|
||||
public function __construct($auth, $guards)
|
||||
{
|
||||
parent::__construct($auth);
|
||||
$this->auth = $auth;
|
||||
$this->guards = $guards;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set to show the users name/email
|
||||
* @param bool $showName
|
||||
*/
|
||||
public function setShowName($showName)
|
||||
{
|
||||
$this->showName = (bool) $showName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @{inheritDoc}
|
||||
@@ -77,6 +94,49 @@ class MultiAuthCollector extends AuthCollector
|
||||
return $guard->user();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get displayed user information
|
||||
* @param \Illuminate\Auth\UserInterface $user
|
||||
* @return array
|
||||
*/
|
||||
protected function getUserInformation($user = null)
|
||||
{
|
||||
// Defaults
|
||||
if (is_null($user)) {
|
||||
return [
|
||||
'name' => 'Guest',
|
||||
'user' => ['guest' => true],
|
||||
];
|
||||
}
|
||||
|
||||
// The default auth identifer is the ID number, which isn't all that
|
||||
// useful. Try username and email.
|
||||
$identifier = $user->getAuthIdentifier();
|
||||
if (is_numeric($identifier)) {
|
||||
try {
|
||||
if ($user->username) {
|
||||
$identifier = $user->username;
|
||||
} elseif ($user->email) {
|
||||
$identifier = $user->email;
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
}
|
||||
}
|
||||
|
||||
return [
|
||||
'name' => $identifier,
|
||||
'user' => $user instanceof Arrayable ? $user->toArray() : $user,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @{inheritDoc}
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return 'auth';
|
||||
}
|
||||
|
||||
/**
|
||||
* @{inheritDoc}
|
||||
*/
|
||||
@@ -102,4 +162,5 @@ class MultiAuthCollector extends AuthCollector
|
||||
|
||||
return $widgets;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -185,7 +185,7 @@ class QueryCollector extends PDOCollector
|
||||
*/
|
||||
protected function findSource()
|
||||
{
|
||||
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT);
|
||||
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT, 50);
|
||||
|
||||
$sources = [];
|
||||
|
||||
@@ -218,13 +218,9 @@ class QueryCollector extends PDOCollector
|
||||
return $frame;
|
||||
}
|
||||
|
||||
if (isset($trace['class']) && isset($trace['file']) && strpos(
|
||||
$trace['file'],
|
||||
DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'laravel' . DIRECTORY_SEPARATOR . 'framework'
|
||||
) === false && strpos(
|
||||
$trace['file'],
|
||||
DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'barryvdh' . DIRECTORY_SEPARATOR . 'laravel-debugbar'
|
||||
) === false
|
||||
if (isset($trace['class']) &&
|
||||
isset($trace['file']) &&
|
||||
!$this->fileIsInExcludedPath($trace['file'])
|
||||
) {
|
||||
$file = $trace['file'];
|
||||
|
||||
@@ -261,6 +257,31 @@ class QueryCollector extends PDOCollector
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the given file is to be excluded from analysis
|
||||
*
|
||||
* @param string $file
|
||||
* @return bool
|
||||
*/
|
||||
protected function fileIsInExcludedPath($file)
|
||||
{
|
||||
$excludedPaths = [
|
||||
'/vendor/laravel/framework/src/Illuminate/Database',
|
||||
'/vendor/laravel/framework/src/Illuminate/Events',
|
||||
'/vendor/barryvdh/laravel-debugbar',
|
||||
];
|
||||
|
||||
$normalizedPath = str_replace('\\', '/', $file);
|
||||
|
||||
foreach ($excludedPaths as $excludedPath) {
|
||||
if (strpos($normalizedPath, $excludedPath) !== false) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the middleware alias from the file.
|
||||
*
|
||||
|
@@ -12,7 +12,7 @@ use Symfony\Component\HttpFoundation\Response;
|
||||
* Based on \Symfony\Component\HttpKernel\DataCollector\RequestDataCollector by Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
*/
|
||||
class SymfonyRequestCollector extends DataCollector implements DataCollectorInterface, Renderable
|
||||
class RequestCollector extends DataCollector implements DataCollectorInterface, Renderable
|
||||
{
|
||||
/** @var \Symfony\Component\HttpFoundation\Request $request */
|
||||
protected $request;
|
@@ -14,7 +14,7 @@ use Illuminate\Support\Facades\Config;
|
||||
* https://github.com/laravel/framework/blob/master/src/Illuminate/Foundation/Console/RoutesCommand.php
|
||||
*
|
||||
*/
|
||||
class IlluminateRouteCollector extends DataCollector implements Renderable
|
||||
class RouteCollector extends DataCollector implements Renderable
|
||||
{
|
||||
/**
|
||||
* The router instance.
|
@@ -2,9 +2,10 @@
|
||||
|
||||
namespace Barryvdh\Debugbar\DataCollector;
|
||||
|
||||
use Barryvdh\Debugbar\DataFormatter\SimpleFormatter;
|
||||
use DebugBar\Bridge\Twig\TwigCollector;
|
||||
use Illuminate\View\View;
|
||||
use Symfony\Component\HttpKernel\DataCollector\Util\ValueExporter;
|
||||
use Symfony\Component\VarDumper\Cloner\VarCloner;
|
||||
|
||||
class ViewCollector extends TwigCollector
|
||||
{
|
||||
@@ -18,10 +19,10 @@ class ViewCollector extends TwigCollector
|
||||
*/
|
||||
public function __construct($collectData = true)
|
||||
{
|
||||
$this->setDataFormatter(new SimpleFormatter());
|
||||
$this->collect_data = $collectData;
|
||||
$this->name = 'views';
|
||||
$this->templates = [];
|
||||
$this->exporter = new ValueExporter();
|
||||
}
|
||||
|
||||
public function getName()
|
||||
@@ -75,17 +76,23 @@ class ViewCollector extends TwigCollector
|
||||
} else {
|
||||
$data = [];
|
||||
foreach ($view->getData() as $key => $value) {
|
||||
$data[$key] = $this->exporter->exportValue($value);
|
||||
$data[$key] = $this->getDataFormatter()->formatVar($value);
|
||||
}
|
||||
$params = $data;
|
||||
}
|
||||
|
||||
$this->templates[] = [
|
||||
$template = [
|
||||
'name' => $path ? sprintf('%s (%s)', $name, $path) : $name,
|
||||
'param_count' => count($params),
|
||||
'params' => $params,
|
||||
'type' => $type,
|
||||
];
|
||||
|
||||
if ( $this->getXdebugLink($path)) {
|
||||
$template['xdebug_link'] = $this->getXdebugLink($path);
|
||||
}
|
||||
|
||||
$this->templates[] = $template;
|
||||
}
|
||||
|
||||
public function collect()
|
||||
|
105
vendor/barryvdh/laravel-debugbar/src/DataFormatter/SimpleFormatter.php
vendored
Normal file
105
vendor/barryvdh/laravel-debugbar/src/DataFormatter/SimpleFormatter.php
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace Barryvdh\Debugbar\DataFormatter;
|
||||
|
||||
use DebugBar\DataFormatter\DataFormatter;
|
||||
|
||||
/**
|
||||
* Simple DataFormatter based on the deprecated Symfony ValueExporter
|
||||
*
|
||||
* @see https://github.com/symfony/symfony/blob/v3.4.4/src/Symfony/Component/HttpKernel/DataCollector/Util/ValueExporter.php
|
||||
*/
|
||||
class SimpleFormatter extends DataFormatter
|
||||
{
|
||||
/**
|
||||
* @param $data
|
||||
* @return string
|
||||
*/
|
||||
public function formatVar($data)
|
||||
{
|
||||
return $this->exportValue($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts a PHP value to a string.
|
||||
*
|
||||
* @param mixed $value The PHP value
|
||||
* @param int $depth Only for internal usage
|
||||
* @param bool $deep Only for internal usage
|
||||
*
|
||||
* @return string The string representation of the given value
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
private function exportValue($value, $depth = 1, $deep = false)
|
||||
{
|
||||
if ($value instanceof \__PHP_Incomplete_Class) {
|
||||
return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value));
|
||||
}
|
||||
|
||||
if (is_object($value)) {
|
||||
if ($value instanceof \DateTimeInterface) {
|
||||
return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ATOM));
|
||||
}
|
||||
|
||||
return sprintf('Object(%s)', get_class($value));
|
||||
}
|
||||
|
||||
if (is_array($value)) {
|
||||
if (empty($value)) {
|
||||
return '[]';
|
||||
}
|
||||
|
||||
$indent = str_repeat(' ', $depth);
|
||||
|
||||
$a = array();
|
||||
foreach ($value as $k => $v) {
|
||||
if (is_array($v)) {
|
||||
$deep = true;
|
||||
}
|
||||
$a[] = sprintf('%s => %s', $k, $this->exportValue($v, $depth + 1, $deep));
|
||||
}
|
||||
|
||||
if ($deep) {
|
||||
return sprintf("[\n%s%s\n%s]", $indent, implode(sprintf(", \n%s", $indent), $a), str_repeat(' ', $depth - 1));
|
||||
}
|
||||
|
||||
$s = sprintf('[%s]', implode(', ', $a));
|
||||
|
||||
if (80 > strlen($s)) {
|
||||
return $s;
|
||||
}
|
||||
|
||||
return sprintf("[\n%s%s\n]", $indent, implode(sprintf(",\n%s", $indent), $a));
|
||||
}
|
||||
|
||||
if (is_resource($value)) {
|
||||
return sprintf('Resource(%s#%d)', get_resource_type($value), $value);
|
||||
}
|
||||
|
||||
if (null === $value) {
|
||||
return 'null';
|
||||
}
|
||||
|
||||
if (false === $value) {
|
||||
return 'false';
|
||||
}
|
||||
|
||||
if (true === $value) {
|
||||
return 'true';
|
||||
}
|
||||
|
||||
return (string) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \__PHP_Incomplete_Class $value
|
||||
* @return mixed
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
|
||||
{
|
||||
$array = new \ArrayObject($value);
|
||||
|
||||
return $array['__PHP_Incomplete_Class_Name'];
|
||||
}
|
||||
}
|
@@ -7,6 +7,6 @@ class Facade extends \Illuminate\Support\Facades\Facade
|
||||
*/
|
||||
protected static function getFacadeAccessor()
|
||||
{
|
||||
return 'debugbar';
|
||||
return LaravelDebugbar::class;
|
||||
}
|
||||
}
|
||||
|
@@ -20,6 +20,7 @@ class JavascriptRenderer extends BaseJavascriptRenderer
|
||||
$this->cssFiles['laravel'] = __DIR__ . '/Resources/laravel-debugbar.css';
|
||||
$this->cssVendors['fontawesome'] = __DIR__ . '/Resources/vendor/font-awesome/style.css';
|
||||
$this->jsFiles['laravel-sql'] = __DIR__ . '/Resources/sqlqueries/widget.js';
|
||||
$this->jsFiles['laravel-cache'] = __DIR__ . '/Resources/cache/widget.js';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,9 +57,24 @@ class JavascriptRenderer extends BaseJavascriptRenderer
|
||||
$html .= '<script type="text/javascript">jQuery.noConflict(true);</script>' . "\n";
|
||||
}
|
||||
|
||||
$html .= $this->getInlineHtml();
|
||||
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
protected function getInlineHtml()
|
||||
{
|
||||
$html = '';
|
||||
|
||||
foreach (['head', 'css', 'js'] as $asset) {
|
||||
foreach ($this->getAssets('inline_' . $asset) as $item) {
|
||||
$html .= $item . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
/**
|
||||
* Get the last modified time of any assets.
|
||||
*
|
||||
|
@@ -1,6 +1,7 @@
|
||||
<?php namespace Barryvdh\Debugbar;
|
||||
|
||||
use Barryvdh\Debugbar\DataCollector\AuthCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\CacheCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\EventCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\FilesCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\GateCollector;
|
||||
@@ -9,13 +10,14 @@ use Barryvdh\Debugbar\DataCollector\LogsCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\MultiAuthCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\QueryCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\SessionCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\SymfonyRequestCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\RequestCollector;
|
||||
use Barryvdh\Debugbar\DataCollector\ViewCollector;
|
||||
use Barryvdh\Debugbar\Storage\FilesystemStorage;
|
||||
use DebugBar\Bridge\MonologCollector;
|
||||
use DebugBar\Bridge\SwiftMailer\SwiftLogCollector;
|
||||
use DebugBar\Bridge\SwiftMailer\SwiftMailCollector;
|
||||
use DebugBar\DataCollector\ConfigCollector;
|
||||
use DebugBar\DataCollector\DataCollectorInterface;
|
||||
use DebugBar\DataCollector\ExceptionsCollector;
|
||||
use DebugBar\DataCollector\MemoryCollector;
|
||||
use DebugBar\DataCollector\MessagesCollector;
|
||||
@@ -124,7 +126,7 @@ class LaravelDebugbar extends DebugBar
|
||||
|
||||
/** @var Application $app */
|
||||
$app = $this->app;
|
||||
|
||||
|
||||
// Set custom error handler
|
||||
if ($app['config']->get('debugbar.error_handler' , false)) {
|
||||
set_error_handler([$this, 'handleError']);
|
||||
@@ -222,7 +224,7 @@ class LaravelDebugbar extends DebugBar
|
||||
|
||||
if (!$this->isLumen() && $this->shouldCollect('route')) {
|
||||
try {
|
||||
$this->addCollector($this->app->make('Barryvdh\Debugbar\DataCollector\IlluminateRouteCollector'));
|
||||
$this->addCollector($this->app->make('Barryvdh\Debugbar\DataCollector\RouteCollector'));
|
||||
} catch (\Exception $e) {
|
||||
$this->addThrowable(
|
||||
new Exception(
|
||||
@@ -317,6 +319,9 @@ class LaravelDebugbar extends DebugBar
|
||||
try {
|
||||
$db->listen(
|
||||
function ($query, $bindings = null, $time = null, $connectionName = null) use ($db, $queryCollector) {
|
||||
if (!$this->shouldCollect('db', true)) {
|
||||
return; // Issue 776 : We've turned off collecting after the listener was attached
|
||||
}
|
||||
// Laravel 5.2 changed the way some core events worked. We must account for
|
||||
// the first argument being an "event object", where arguments are passed
|
||||
// via object properties, instead of individual arguments.
|
||||
@@ -436,13 +441,8 @@ class LaravelDebugbar extends DebugBar
|
||||
|
||||
if ($this->shouldCollect('auth', false)) {
|
||||
try {
|
||||
if($this->checkVersion('5.2')) {
|
||||
// fix for compatibility with Laravel 5.2.*
|
||||
$guards = array_keys($this->app['config']->get('auth.guards'));
|
||||
$authCollector = new MultiAuthCollector($app['auth'], $guards);
|
||||
} else {
|
||||
$authCollector = new AuthCollector($app['auth']);
|
||||
}
|
||||
$guards = array_keys($this->app['config']->get('auth.guards', []));
|
||||
$authCollector = new MultiAuthCollector($app['auth'], $guards);
|
||||
|
||||
$authCollector->setShowName(
|
||||
$this->app['config']->get('debugbar.options.auth.show_name')
|
||||
@@ -466,6 +466,25 @@ class LaravelDebugbar extends DebugBar
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->shouldCollect('cache', false) && isset($this->app['events'])) {
|
||||
try {
|
||||
$collectValues = $this->app['config']->get('debugbar.options.cache.values', true);
|
||||
$startTime = $this->app['request']->server('REQUEST_TIME_FLOAT');
|
||||
$cacheCollector = new CacheCollector($startTime, $collectValues);
|
||||
$this->addCollector($cacheCollector);
|
||||
$this->app['events']->subscribe($cacheCollector);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
$this->addThrowable(
|
||||
new Exception(
|
||||
'Cannot add CacheCollector to Laravel Debugbar: ' . $e->getMessage(),
|
||||
$e->getCode(),
|
||||
$e
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$renderer = $this->getJavascriptRenderer();
|
||||
$renderer->setIncludeVendors($this->app['config']->get('debugbar.include_vendors', true));
|
||||
$renderer->setBindAjaxHandlerToXHR($app['config']->get('debugbar.capture_ajax', true));
|
||||
@@ -478,6 +497,25 @@ class LaravelDebugbar extends DebugBar
|
||||
return $this->app['config']->get('debugbar.collectors.' . $name, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a data collector
|
||||
*
|
||||
* @param DataCollectorInterface $collector
|
||||
*
|
||||
* @throws DebugBarException
|
||||
* @return $this
|
||||
*/
|
||||
public function addCollector(DataCollectorInterface $collector)
|
||||
{
|
||||
parent::addCollector($collector);
|
||||
|
||||
if (method_exists($collector, 'useHtmlVarDumper')) {
|
||||
$collector->useHtmlVarDumper();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle silenced errors
|
||||
*
|
||||
@@ -580,7 +618,7 @@ class LaravelDebugbar extends DebugBar
|
||||
public function modifyResponse(Request $request, Response $response)
|
||||
{
|
||||
$app = $this->app;
|
||||
if ($app->runningInConsole() || !$this->isEnabled() || $this->isDebugbarRequest()) {
|
||||
if (!$this->isEnabled() || $this->isDebugbarRequest()) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -631,7 +669,7 @@ class LaravelDebugbar extends DebugBar
|
||||
|
||||
if ($this->shouldCollect('symfony_request', true) && !$this->hasCollector('request')) {
|
||||
try {
|
||||
$this->addCollector(new SymfonyRequestCollector($request, $response, $sessionManager));
|
||||
$this->addCollector(new RequestCollector($request, $response, $sessionManager));
|
||||
} catch (\Exception $e) {
|
||||
$this->addThrowable(
|
||||
new Exception(
|
||||
@@ -712,7 +750,14 @@ class LaravelDebugbar extends DebugBar
|
||||
public function isEnabled()
|
||||
{
|
||||
if ($this->enabled === null) {
|
||||
$this->enabled = value($this->app['config']->get('debugbar.enabled'));
|
||||
$config = $this->app['config'];
|
||||
$configEnabled = value($config->get('debugbar.enabled'));
|
||||
|
||||
if ($configEnabled === null) {
|
||||
$configEnabled = $config->get('app.debug');
|
||||
}
|
||||
|
||||
$this->enabled = $configEnabled && !$this->app->runningInConsole() && !$this->app->environment('testing');
|
||||
}
|
||||
|
||||
return $this->enabled;
|
||||
@@ -970,7 +1015,7 @@ class LaravelDebugbar extends DebugBar
|
||||
case 'redis':
|
||||
$connection = $config->get('debugbar.storage.connection');
|
||||
$client = $this->app['redis']->connection($connection);
|
||||
if (is_a($client, 'Illuminate\Redis\Connections\PredisConnection', false)) {
|
||||
if (is_a($client, 'Illuminate\Redis\Connections\Connection', false)) {
|
||||
$client = $client->client();
|
||||
}
|
||||
$storage = new RedisStorage($client);
|
||||
@@ -1011,7 +1056,7 @@ class LaravelDebugbar extends DebugBar
|
||||
|
||||
$headers = [];
|
||||
foreach ($collector->collect()['measures'] as $k => $m) {
|
||||
$headers[] = sprintf('%d=%F; "%s"', $k, $m['duration'], str_replace('"', "'", $m['label']));
|
||||
$headers[] = sprintf('%d=%F; "%s"', $k, $m['duration'] * 1000, str_replace('"', "'", $m['label']));
|
||||
}
|
||||
|
||||
$response->headers->set('Server-Timing', $headers, false);
|
||||
|
@@ -14,7 +14,7 @@ class LumenServiceProvider extends ServiceProvider
|
||||
*/
|
||||
protected function getRouter()
|
||||
{
|
||||
return $this->app;
|
||||
return $this->app->router;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -37,14 +37,6 @@ class LumenServiceProvider extends ServiceProvider
|
||||
$this->app->middleware([$middleware]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the App Debug status
|
||||
*/
|
||||
protected function checkAppDebug()
|
||||
{
|
||||
return env('APP_DEBUG');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
|
42
vendor/barryvdh/laravel-debugbar/src/Middleware/DebugbarEnabled.php
vendored
Normal file
42
vendor/barryvdh/laravel-debugbar/src/Middleware/DebugbarEnabled.php
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php namespace Barryvdh\Debugbar\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Http\Request;
|
||||
use Barryvdh\Debugbar\LaravelDebugbar;
|
||||
|
||||
class DebugbarEnabled
|
||||
{
|
||||
/**
|
||||
* The DebugBar instance
|
||||
*
|
||||
* @var LaravelDebugbar
|
||||
*/
|
||||
protected $debugbar;
|
||||
|
||||
/**
|
||||
* Create a new middleware instance.
|
||||
*
|
||||
* @param LaravelDebugbar $debugbar
|
||||
*/
|
||||
public function __construct(LaravelDebugbar $debugbar)
|
||||
{
|
||||
$this->debugbar = $debugbar;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Closure $next
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (!$this->debugbar->isEnabled()) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
||||
}
|
||||
}
|
@@ -9,7 +9,7 @@ use Illuminate\Contracts\Container\Container;
|
||||
use Illuminate\Contracts\Debug\ExceptionHandler;
|
||||
use Symfony\Component\Debug\Exception\FatalThrowableError;
|
||||
|
||||
class Debugbar
|
||||
class InjectDebugbar
|
||||
{
|
||||
/**
|
||||
* The App container
|
||||
@@ -25,6 +25,13 @@ class Debugbar
|
||||
*/
|
||||
protected $debugbar;
|
||||
|
||||
/**
|
||||
* The URIs that should be excluded.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $except = [];
|
||||
|
||||
/**
|
||||
* Create a new middleware instance.
|
||||
*
|
||||
@@ -35,6 +42,7 @@ class Debugbar
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->debugbar = $debugbar;
|
||||
$this->except = config('debugbar.except') ?: [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,6 +54,12 @@ class Debugbar
|
||||
*/
|
||||
public function handle($request, Closure $next)
|
||||
{
|
||||
if (!$this->debugbar->isEnabled() || $this->inExceptArray($request)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
$this->debugbar->boot();
|
||||
|
||||
try {
|
||||
/** @var \Illuminate\Http\Response $response */
|
||||
$response = $next($request);
|
||||
@@ -85,4 +99,25 @@ class Debugbar
|
||||
|
||||
return $handler->render($passable, $e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the request has a URI that should be ignored.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return bool
|
||||
*/
|
||||
protected function inExceptArray($request)
|
||||
{
|
||||
foreach ($this->except as $except) {
|
||||
if ($except !== '/') {
|
||||
$except = trim($except, '/');
|
||||
}
|
||||
|
||||
if ($request->is($except)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
59
vendor/barryvdh/laravel-debugbar/src/Resources/cache/widget.js
vendored
Normal file
59
vendor/barryvdh/laravel-debugbar/src/Resources/cache/widget.js
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
(function($) {
|
||||
|
||||
var csscls = PhpDebugBar.utils.makecsscls('phpdebugbar-widgets-');
|
||||
|
||||
/**
|
||||
* Widget for the displaying cache events
|
||||
*
|
||||
* Options:
|
||||
* - data
|
||||
*/
|
||||
var LaravelCacheWidget = PhpDebugBar.Widgets.LaravelCacheWidget = PhpDebugBar.Widgets.TimelineWidget.extend({
|
||||
|
||||
tagName: 'ul',
|
||||
|
||||
className: csscls('timeline cache'),
|
||||
|
||||
onForgetClick: function(e, el) {
|
||||
e.stopPropagation();
|
||||
|
||||
$.ajax({
|
||||
url: $(el).attr("data-url"),
|
||||
type: 'DELETE',
|
||||
success: function(result) {
|
||||
$(el).fadeOut(200);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
render: function() {
|
||||
LaravelCacheWidget.__super__.render.apply(this);
|
||||
|
||||
this.bindAttr('data', function(data) {
|
||||
|
||||
if (data.measures) {
|
||||
var self = this;
|
||||
var lines = this.$el.find('.'+csscls('measure'));
|
||||
|
||||
for (var i = 0; i < data.measures.length; i++) {
|
||||
var measure = data.measures[i];
|
||||
var m = lines[i];
|
||||
|
||||
if (measure.params && !$.isEmptyObject(measure.params)) {
|
||||
|
||||
if (measure.params.delete && measure.params.key) {
|
||||
$('<a />')
|
||||
.addClass(csscls('forget'))
|
||||
.text('forget')
|
||||
.attr('data-url', measure.params.delete)
|
||||
.one('click', function(e) { self.onForgetClick(e, this); })
|
||||
.appendTo(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
})(PhpDebugBar.$);
|
@@ -3,6 +3,7 @@ div.phpdebugbar {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", "Lucida Sans", Geneva, Verdana, sans-serif;
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
z-index: 100000;
|
||||
}
|
||||
|
||||
div.phpdebugbar-resize-handle {
|
||||
@@ -18,14 +19,23 @@ a.phpdebugbar-restore-btn {
|
||||
border-right-color: #ddd !important;
|
||||
}
|
||||
|
||||
div.phpdebugbar code, div.phpdebugbar pre {
|
||||
div.phpdebugbar code, div.phpdebugbar pre, div.phpdebugbar samp {
|
||||
background: none;
|
||||
font-family: monospace;
|
||||
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
font-size: 1em;
|
||||
border: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
div.phpdebugbar code, div.phpdebugbar pre {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
div.phpdebugbar pre.sf-dump {
|
||||
color: #a0a000;
|
||||
outline: 0;
|
||||
}
|
||||
|
||||
div.phpdebugbar-body {
|
||||
border-top: none;
|
||||
}
|
||||
@@ -195,7 +205,7 @@ div.phpdebugbar-widgets-messages div.phpdebugbar-widgets-toolbar a.phpdebugbar-w
|
||||
}
|
||||
|
||||
ul.phpdebugbar-widgets-list li.phpdebugbar-widgets-list-item {
|
||||
padding: 5px 10px;
|
||||
padding: 15px 10px;
|
||||
border: none;
|
||||
font-family: inherit;
|
||||
overflow: visible;
|
||||
@@ -210,6 +220,7 @@ ul.phpdebugbar-widgets-list li.phpdebugbar-widgets-list-item {
|
||||
ul.phpdebugbar-widgets-list li.phpdebugbar-widgets-list-item .phpdebugbar-widgets-sql {
|
||||
flex: 1;
|
||||
margin-right: 5px;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
ul.phpdebugbar-widgets-list li.phpdebugbar-widgets-list-item .phpdebugbar-widgets-duration {
|
||||
@@ -294,3 +305,15 @@ ul.phpdebugbar-widgets-list li.phpdebugbar-widgets-table-list-item {
|
||||
.phpdebugbar-text-muted {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
ul.phpdebugbar-widgets-cache a.phpdebugbar-widgets-forget {
|
||||
float: right;
|
||||
font-size: 12px;
|
||||
padding: 0 4px;
|
||||
background: #f4645f;
|
||||
margin: 0 2px;
|
||||
border-radius: 4px;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
line-height: 1.5rem;
|
||||
}
|
@@ -186,6 +186,9 @@
|
||||
if (data.statements[i].bindings && data.statements[i].bindings.length) {
|
||||
stmt += JSON.stringify(data.statements[i].bindings);
|
||||
}
|
||||
if (data.statements[i].connection) {
|
||||
stmt += '@' + data.statements[i].connection;
|
||||
}
|
||||
sql[stmt] = sql[stmt] || { keys: [] };
|
||||
sql[stmt].keys.push(i);
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@@ -1,5 +1,10 @@
|
||||
<?php namespace Barryvdh\Debugbar;
|
||||
|
||||
use Barryvdh\Debugbar\Middleware\DebugbarEnabled;
|
||||
use Barryvdh\Debugbar\Middleware\InjectDebugbar;
|
||||
use DebugBar\DataFormatter\DataFormatter;
|
||||
use DebugBar\DataFormatter\DataFormatterInterface;
|
||||
use Illuminate\Contracts\Http\Kernel;
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Session\SessionManager;
|
||||
|
||||
@@ -23,15 +28,15 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
$this->mergeConfigFrom($configPath, 'debugbar');
|
||||
|
||||
$this->app->alias(
|
||||
'DebugBar\DataFormatter\DataFormatter',
|
||||
'DebugBar\DataFormatter\DataFormatterInterface'
|
||||
DataFormatter::class,
|
||||
DataFormatterInterface::class
|
||||
);
|
||||
|
||||
$this->app->singleton('debugbar', function ($app) {
|
||||
$debugbar = new LaravelDebugbar($app);
|
||||
$this->app->singleton(LaravelDebugbar::class, function () {
|
||||
$debugbar = new LaravelDebugbar($this->app);
|
||||
|
||||
if ($app->bound(SessionManager::class)) {
|
||||
$sessionManager = $app->make(SessionManager::class);
|
||||
if ($this->app->bound(SessionManager::class)) {
|
||||
$sessionManager = $this->app->make(SessionManager::class);
|
||||
$httpDriver = new SymfonyHttpDriver($sessionManager);
|
||||
$debugbar->setHttpDriver($httpDriver);
|
||||
}
|
||||
@@ -40,7 +45,7 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
}
|
||||
);
|
||||
|
||||
$this->app->alias('debugbar', 'Barryvdh\Debugbar\LaravelDebugbar');
|
||||
$this->app->alias(LaravelDebugbar::class, 'debugbar');
|
||||
|
||||
$this->app->singleton('command.debugbar.clear',
|
||||
function ($app) {
|
||||
@@ -58,26 +63,14 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$app = $this->app;
|
||||
|
||||
$configPath = __DIR__ . '/../config/debugbar.php';
|
||||
$this->publishes([$configPath => $this->getConfigPath()], 'config');
|
||||
|
||||
// If enabled is null, set from the app.debug value
|
||||
$enabled = $this->app['config']->get('debugbar.enabled');
|
||||
|
||||
if (is_null($enabled)) {
|
||||
$enabled = $this->checkAppDebug();
|
||||
}
|
||||
|
||||
if (! $enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
$routeConfig = [
|
||||
'namespace' => 'Barryvdh\Debugbar\Controllers',
|
||||
'prefix' => $this->app['config']->get('debugbar.route_prefix'),
|
||||
'domain' => $this->app['config']->get('debugbar.route_domain'),
|
||||
'middleware' => [DebugbarEnabled::class],
|
||||
];
|
||||
|
||||
$this->getRouter()->group($routeConfig, function($router) {
|
||||
@@ -100,18 +93,14 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
'uses' => 'AssetController@js',
|
||||
'as' => 'debugbar.assets.js',
|
||||
]);
|
||||
|
||||
$router->delete('cache/{key}/{tags?}', [
|
||||
'uses' => 'CacheController@delete',
|
||||
'as' => 'debugbar.cache.delete',
|
||||
]);
|
||||
});
|
||||
|
||||
if ($app->runningInConsole() || $app->environment('testing')) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var LaravelDebugbar $debugbar */
|
||||
$debugbar = $this->app['debugbar'];
|
||||
$debugbar->enable();
|
||||
$debugbar->boot();
|
||||
|
||||
$this->registerMiddleware('Barryvdh\Debugbar\Middleware\Debugbar');
|
||||
$this->registerMiddleware(InjectDebugbar::class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,18 +140,10 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
*/
|
||||
protected function registerMiddleware($middleware)
|
||||
{
|
||||
$kernel = $this->app['Illuminate\Contracts\Http\Kernel'];
|
||||
$kernel = $this->app[Kernel::class];
|
||||
$kernel->pushMiddleware($middleware);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the App Debug status
|
||||
*/
|
||||
protected function checkAppDebug()
|
||||
{
|
||||
return $this->app['config']->get('app.debug');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
@@ -170,6 +151,6 @@ class ServiceProvider extends \Illuminate\Support\ServiceProvider
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return ['debugbar', 'command.debugbar.clear'];
|
||||
return ['debugbar', 'command.debugbar.clear', DataFormatterInterface::class, LaravelDebugbar::class];
|
||||
}
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ class FilesystemStorage implements StorageInterface
|
||||
{
|
||||
if (!$this->files->isDirectory($this->dirname)) {
|
||||
if ($this->files->makeDirectory($this->dirname, 0777, true)) {
|
||||
$this->files->put($this->dirname . '.gitignore', "*\n!.gitignore");
|
||||
$this->files->put($this->dirname . '.gitignore', "*\n!.gitignore\n");
|
||||
} else {
|
||||
throw new \Exception("Cannot create directory '$this->dirname'..");
|
||||
}
|
||||
|
@@ -11,8 +11,9 @@ use Symfony\Component\HttpFoundation\Session\Session;
|
||||
*/
|
||||
class SymfonyHttpDriver implements HttpDriverInterface
|
||||
{
|
||||
/** @var \Symfony\Component\HttpFoundation\Session\Session|\Illuminate\Contracts\Session\Session|\Illuminate\Session\SessionManager */
|
||||
/** @var \Illuminate\Contracts\Session\Session|\Illuminate\Session\SessionManager */
|
||||
protected $session;
|
||||
|
||||
/** @var \Symfony\Component\HttpFoundation\Response */
|
||||
protected $response;
|
||||
|
||||
@@ -40,6 +41,7 @@ class SymfonyHttpDriver implements HttpDriverInterface
|
||||
if (!$this->session->isStarted()) {
|
||||
$this->session->start();
|
||||
}
|
||||
|
||||
return $this->session->isStarted();
|
||||
}
|
||||
|
||||
@@ -48,14 +50,7 @@ class SymfonyHttpDriver implements HttpDriverInterface
|
||||
*/
|
||||
public function setSessionValue($name, $value)
|
||||
{
|
||||
// In Laravel 5.4 the session changed to use their own custom implementation
|
||||
// instead of the one from Symfony. One of the changes was the set method
|
||||
// that was changed to put. Here we check if we are using the new one.
|
||||
if (method_exists($this->session, 'driver') && $this->session->driver() instanceof \Illuminate\Contracts\Session\Session) {
|
||||
$this->session->put($name, $value);
|
||||
return;
|
||||
}
|
||||
$this->session->set($name, $value);
|
||||
$this->session->put($name, $value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
12
vendor/barryvdh/laravel-debugbar/src/helpers.php
vendored
12
vendor/barryvdh/laravel-debugbar/src/helpers.php
vendored
@@ -8,7 +8,7 @@ if (!function_exists('debugbar')) {
|
||||
*/
|
||||
function debugbar()
|
||||
{
|
||||
return app('debugbar');
|
||||
return app(\Barryvdh\Debugbar\LaravelDebugbar::class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ if (!function_exists('debug')) {
|
||||
*/
|
||||
function debug($value)
|
||||
{
|
||||
$debugbar = app('debugbar');
|
||||
$debugbar = debugbar();
|
||||
foreach (func_get_args() as $value) {
|
||||
$debugbar->addMessage($value, 'debug');
|
||||
}
|
||||
@@ -37,7 +37,7 @@ if (!function_exists('start_measure')) {
|
||||
*/
|
||||
function start_measure($name, $label = null)
|
||||
{
|
||||
app('debugbar')->startMeasure($name, $label);
|
||||
debugbar()->startMeasure($name, $label);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ if (!function_exists('stop_measure')) {
|
||||
*/
|
||||
function stop_measure($name)
|
||||
{
|
||||
app('debugbar')->stopMeasure($name);
|
||||
debugbar()->stopMeasure($name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ if (!function_exists('add_measure')) {
|
||||
*/
|
||||
function add_measure($label, $start, $end)
|
||||
{
|
||||
app('debugbar')->addMeasure($label, $start, $end);
|
||||
debugbar()->addMeasure($label, $start, $end);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,6 +76,6 @@ if (!function_exists('measure')) {
|
||||
*/
|
||||
function measure($label, \Closure $closure)
|
||||
{
|
||||
app('debugbar')->measure($label, $closure);
|
||||
debugbar()->measure($label, $closure);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user