forked from andrey-mokhov/bjy-profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
896 additions
and
895 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
nbproject | ||
._* | ||
.~lock.* | ||
.buildpath | ||
.DS_Store | ||
.idea | ||
.project | ||
.settings | ||
/vendor/ | ||
phpunit.xml | ||
/build/ | ||
nbproject | ||
._* | ||
.~lock.* | ||
.buildpath | ||
.DS_Store | ||
.idea | ||
.project | ||
.settings | ||
/vendor/ | ||
phpunit.xml | ||
/build/ | ||
/.phpunit.result.cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
BjyProfiler | ||
=========== | ||
|
||
1.3.1-dev: | ||
|
||
Provides Laminas\Db adapters with extensions for database query profiling, as well as a profiler similar to ZF1's Zend\_Db\_Profiler. | ||
BJYoungblood ported much of this code from ZF1's Zend_Db. | ||
|
||
Note: this module now works with Laminas\Db's built-in profiler. | ||
|
||
**Note**: PHP >= 5.5 is required for stack traces with query profiles. | ||
|
||
Composer/Packagist Users | ||
======================== | ||
|
||
```console | ||
composer require --dev portospire/bjy-profiler | ||
``` | ||
|
||
Configuration & Usage | ||
--------------------- | ||
Add `BjyProfiler` to your `development.config.php` in section `modules`, example: | ||
```php | ||
return [ | ||
// Additional modules to include when in development mode | ||
'modules' => [ | ||
'BjyProfiler', | ||
], | ||
// Configuration overrides during development mode | ||
'module_listener_options' => [ | ||
'config_glob_paths' => [realpath(__DIR__) . '/autoload/{,*.}{global,local}-development.php'], | ||
'config_cache_enabled' => false, | ||
'module_map_cache_enabled' => false, | ||
], | ||
]; | ||
``` | ||
|
||
|
||
```php | ||
$profiler = $sl->get('Laminas\Db\Adapter\Adapter')->getProfiler(); | ||
$queryProfiles = $profiler->getQueryProfiles(); | ||
``` | ||
BjyProfiler | ||
=========== | ||
|
||
Version 1.3.1 | ||
|
||
Provides Laminas\Db adapters with extensions for database query profiling, as well as a profiler similar to ZF1's Zend\_Db\_Profiler. | ||
BJYoungblood ported much of this code from ZF1's Zend_Db. | ||
|
||
Note: this module now works with Laminas\Db's built-in profiler. | ||
|
||
**Note**: PHP >= 5.5 is required for stack traces with query profiles. | ||
|
||
Composer/Packagist Users | ||
======================== | ||
|
||
```console | ||
composer require --dev portospire/bjy-profiler | ||
``` | ||
|
||
Configuration & Usage | ||
--------------------- | ||
Add `BjyProfiler` to your `development.config.php` in section `modules`, example: | ||
```php | ||
return [ | ||
// Additional modules to include when in development mode | ||
'modules' => [ | ||
'BjyProfiler', | ||
], | ||
// Configuration overrides during development mode | ||
'module_listener_options' => [ | ||
'config_glob_paths' => [realpath(__DIR__) . '/autoload/{,*.}{global,local}-development.php'], | ||
'config_cache_enabled' => false, | ||
'module_map_cache_enabled' => false, | ||
], | ||
]; | ||
``` | ||
|
||
|
||
```php | ||
$profiler = $sl->get('Laminas\Db\Adapter\Adapter')->getProfiler(); | ||
$queryProfiles = $profiler->getQueryProfiles(); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,53 +1,53 @@ | ||
{ | ||
"name": "portospire/bjy-profiler", | ||
"description": "Database profiler for Laminas\\Db (also plugin for LaminasDeveloperTools). Module forked from andrey-mokhov/bjy-profiler", | ||
"type": "library", | ||
"license": "MIT", | ||
"keywords": [ | ||
"zf3", | ||
"db", | ||
"profiler", | ||
"zdt", | ||
"laminas" | ||
], | ||
"homepage": "https://github.com/PortoSpire/BjyProfiler", | ||
"authors": [ | ||
{ | ||
"name": "Ben Youngblood", | ||
"email": "bx.youngblood@gmail.com", | ||
"homepage": "http://bjyoungblood.com/" | ||
}, | ||
{ | ||
"name": "Andrey N. Mokhov", | ||
"email": "github@mokhov.com", | ||
"homepage": "https://github.com/andrey-mokhov" | ||
}, | ||
{ | ||
"name": "PortoSpire", | ||
"email": "psorders@portospire.com", | ||
"homepage": "https://portospire.github.io" | ||
} | ||
], | ||
"require": { | ||
"php": "^5.5 || ^7.0", | ||
"laminas/laminas-servicemanager": "^3.0.3", | ||
"laminas/laminas-modulemanager": "^2.7", | ||
"laminas/laminas-db": "^2.7", | ||
"laminas/laminas-log": "^2.7" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"BjyProfiler\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"zf": { | ||
"module": "BjyProfiler", | ||
"config-provider": "BjyProfiler\\ConfigProvider" | ||
} | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^4.0 || ^5.0", | ||
"laminas/laminas-mvc": "^2.7 || ^3.0" | ||
} | ||
} | ||
{ | ||
"name": "portospire/bjy-profiler", | ||
"description": "Database profiler for Laminas\\Db (also plugin for LaminasDeveloperTools). Module forked from andrey-mokhov/bjy-profiler", | ||
"type": "library", | ||
"license": "MIT", | ||
"keywords": [ | ||
"zf3", | ||
"db", | ||
"profiler", | ||
"zdt", | ||
"laminas" | ||
], | ||
"homepage": "https://github.com/PortoSpire/BjyProfiler", | ||
"authors": [ | ||
{ | ||
"name": "Ben Youngblood", | ||
"email": "bx.youngblood@gmail.com", | ||
"homepage": "http://bjyoungblood.com/" | ||
}, | ||
{ | ||
"name": "Andrey N. Mokhov", | ||
"email": "github@mokhov.com", | ||
"homepage": "https://github.com/andrey-mokhov" | ||
}, | ||
{ | ||
"name": "PortoSpire", | ||
"email": "psorders@portospire.com", | ||
"homepage": "https://portospire.github.io" | ||
} | ||
], | ||
"require": { | ||
"php": "^5.5 || ^7.0", | ||
"laminas/laminas-servicemanager": "^3.0.3", | ||
"laminas/laminas-modulemanager": "^2.7", | ||
"laminas/laminas-db": "^2.7", | ||
"laminas/laminas-log": "^2.7" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"BjyProfiler\\": "src/" | ||
} | ||
}, | ||
"extra": { | ||
"zf": { | ||
"module": "BjyProfiler", | ||
"config-provider": "BjyProfiler\\ConfigProvider" | ||
} | ||
}, | ||
"require-dev": { | ||
"phpunit/phpunit": "^6.0", | ||
"laminas/laminas-mvc": "^3.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-db for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace BjyProfiler; | ||
|
||
use BjyProfiler\Db\Adapter\ProfilingAdapterFactory; | ||
use Laminas\Db\Adapter\AdapterInterface; | ||
|
||
class ConfigProvider | ||
{ | ||
/** | ||
* Retrieve BjyProfiler default configuration. | ||
* | ||
* @return array | ||
*/ | ||
public function __invoke() | ||
{ | ||
return [ | ||
'dependencies' => $this->getDependencyConfig(), | ||
]; | ||
} | ||
|
||
/** | ||
* Retrieve BjyProfiler default dependency configuration. | ||
* | ||
* @return array | ||
*/ | ||
public function getDependencyConfig() | ||
{ | ||
return [ | ||
'factories' => [ | ||
AdapterInterface::class => ProfilingAdapterFactory::class, | ||
], | ||
]; | ||
} | ||
} | ||
<?php | ||
/** | ||
* @link http://github.com/zendframework/zend-db for the canonical source repository | ||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com) | ||
* @license http://framework.zend.com/license/new-bsd New BSD License | ||
*/ | ||
|
||
namespace BjyProfiler; | ||
|
||
use BjyProfiler\Db\Adapter\ProfilingAdapterFactory; | ||
use \Laminas\Db\Adapter\AdapterInterface; | ||
|
||
class ConfigProvider | ||
{ | ||
/** | ||
* Retrieve BjyProfiler default configuration. | ||
* | ||
* @return array | ||
*/ | ||
public function __invoke() | ||
{ | ||
return [ | ||
'dependencies' => $this->getDependencyConfig(), | ||
]; | ||
} | ||
|
||
/** | ||
* Retrieve BjyProfiler default dependency configuration. | ||
* | ||
* @return array | ||
*/ | ||
public function getDependencyConfig() | ||
{ | ||
return [ | ||
'factories' => [ | ||
AdapterInterface::class => ProfilingAdapterFactory::class, | ||
], | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
<?php | ||
|
||
namespace BjyProfilerTest; | ||
|
||
use BjyProfiler\ConfigProvider; | ||
use BjyProfiler\Db\Adapter\ProfilingAdapterFactory; | ||
use Zend\Db\Adapter\AdapterInterface; | ||
|
||
class ConfigProviderTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
public function testInvoke() | ||
{ | ||
$instance = new ConfigProvider(); | ||
$config = $instance(); | ||
self::assertArrayHasKey('dependencies', $config); | ||
self::assertArrayHasKey('factories', $config['dependencies']); | ||
self::assertArrayHasKey(AdapterInterface::class, $config['dependencies']['factories']); | ||
} | ||
|
||
public function testGetDependencyConfig() | ||
{ | ||
$instance = new ConfigProvider(); | ||
$config = $instance->getDependencyConfig(); | ||
self::assertArrayHasKey('factories', $config); | ||
self::assertArrayHasKey(AdapterInterface::class, $config['factories']); | ||
self::assertEquals(ProfilingAdapterFactory::class, $config['factories'][AdapterInterface::class]); | ||
} | ||
} | ||
<?php | ||
|
||
namespace BjyProfilerTest; | ||
|
||
use BjyProfiler\ConfigProvider; | ||
use BjyProfiler\Db\Adapter\ProfilingAdapterFactory; | ||
use Laminas\Db\Adapter\AdapterInterface; | ||
|
||
class ConfigProviderTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
public function testInvoke() | ||
{ | ||
$instance = new ConfigProvider(); | ||
$config = $instance(); | ||
self::assertArrayHasKey('dependencies', $config); | ||
self::assertArrayHasKey('factories', $config['dependencies']); | ||
self::assertArrayHasKey(AdapterInterface::class, $config['dependencies']['factories']); | ||
} | ||
|
||
public function testGetDependencyConfig() | ||
{ | ||
$instance = new ConfigProvider(); | ||
$config = $instance->getDependencyConfig(); | ||
self::assertArrayHasKey('factories', $config); | ||
self::assertArrayHasKey(AdapterInterface::class, $config['factories']); | ||
self::assertEquals(ProfilingAdapterFactory::class, $config['factories'][AdapterInterface::class]); | ||
} | ||
} |
Oops, something went wrong.