Skip to content

Commit

Permalink
Merge release-1.3.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
criterion9 committed Jan 26, 2020
2 parents d13dcc1 + ec58698 commit dd4accf
Show file tree
Hide file tree
Showing 12 changed files with 896 additions and 895 deletions.
23 changes: 12 additions & 11 deletions .gitignore
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
84 changes: 42 additions & 42 deletions README.md
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();
```
106 changes: 53 additions & 53 deletions composer.json
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"
}
}
80 changes: 40 additions & 40 deletions src/ConfigProvider.php
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,
],
];
}
}
56 changes: 28 additions & 28 deletions tests/ConfigProviderTest.php
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]);
}
}
Loading

0 comments on commit dd4accf

Please sign in to comment.