Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .coveralls.yml

This file was deleted.

25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,29 @@ A tiny extension of `MySqlConnection` that manages **session** system variables
composer require mpyw/laravel-mysql-system-variable-manager
```

The default implementation is provided by the automatically-discovered service provider.

## Basic Usage

The default implementation is provided by `LaravelMySqlSystemVariableManagerServiceProvider`, however, **package discovery is not available**.
Be careful that you MUST register it in **`config/app.php`** by yourself.

```php
<?php

return [

/* ... */

'providers' => [
/* ... */

Mpyw\LaravelMySqlSystemVariableManager\LaravelMySqlSystemVariableManagerServiceProvider::class,

/* ... */
],

];
```

```php
<?php

Expand Down Expand Up @@ -70,7 +89,7 @@ class DatabaseServiceProvider extends ServiceProvider
namespace App\Database;

use Illuminate\Database\Connection as BaseMySqlConnection;
use Mpyw\LaravelMysqlSystemVariableManager\ManagesSystemVariables;
use Mpyw\LaravelMySqlSystemVariableManager\ManagesSystemVariables;

class MySqlConnection extends BaseMySqlConnection
{
Expand Down
11 changes: 2 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
"keywords": ["laravel", "illuminate", "mysql", "system", "variable"],
"autoload": {
"psr-4": {
"Mpyw\\LaravelMysqlSystemVariableManager\\": "src/"
"Mpyw\\LaravelMySqlSystemVariableManager\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Lampager\\Laravel\\Tests\\": "tests/"
"Mpyw\\LaravelMySqlSystemVariableManager\\Tests\\": "tests/"
}
},
"require": {
Expand All @@ -31,12 +31,5 @@
"laravel/framework": "^6.0",
"nilportugues/sql-query-formatter": "^1.2",
"friendsofphp/php-cs-fixer": "^2.15"
},
"extra": {
"laravel": {
"providers": [
"Mpyw\\LaravelMysqlSystemVariableManager\\LaravelMysqlSystemVariableManagerServiceProvider"
]
}
}
}
19 changes: 19 additions & 0 deletions src/LaravelMySqlSystemVariableManagerServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

namespace Mpyw\LaravelMySqlSystemVariableManager;

use Illuminate\Database\Connection;
use Illuminate\Support\ServiceProvider;

/**
* Class LaravelMySqlSystemVariableManagerServiceProvider
*/
class LaravelMySqlSystemVariableManagerServiceProvider extends ServiceProvider
{
public function boot(): void
{
Connection::resolverFor('mysql', function (...$parameters) {
return new MySqlConnection(...$parameters);
});
}
}
6 changes: 3 additions & 3 deletions src/LaravelMysqlSystemVariableManagerServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

namespace Mpyw\LaravelMysqlSystemVariableManager;
namespace Mpyw\LaravelMySqlSystemVariableManager;

use Illuminate\Database\Connection;
use Illuminate\Support\ServiceProvider;

/**
* Class LaravelMysqlSystemVariableManagerServiceProvider
* Class LaravelMySqlSystemVariableManagerServiceProvider
*/
class LaravelMysqlSystemVariableManagerServiceProvider extends ServiceProvider
class LaravelMySqlSystemVariableManagerServiceProvider extends ServiceProvider
{
public function boot(): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/ManagesSystemVariables.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Mpyw\LaravelMysqlSystemVariableManager;
namespace Mpyw\LaravelMySqlSystemVariableManager;

/**
* Trait ManagesSystemVariables
Expand Down
2 changes: 1 addition & 1 deletion src/MySqlConnection.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Mpyw\LaravelMysqlSystemVariableManager;
namespace Mpyw\LaravelMySqlSystemVariableManager;

use Illuminate\Database\MySqlConnection as BaseMySqlConnection;

Expand Down
2 changes: 1 addition & 1 deletion src/PdoDecorator.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Mpyw\LaravelMysqlSystemVariableManager;
namespace Mpyw\LaravelMySqlSystemVariableManager;

use Closure;
use PDO;
Expand Down
4 changes: 2 additions & 2 deletions src/SystemVariableAwareReconnector.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace Mpyw\LaravelMysqlSystemVariableManager;
namespace Mpyw\LaravelMySqlSystemVariableManager;

use Illuminate\Database\ConnectionInterface;
use LogicException;
Expand Down Expand Up @@ -41,7 +41,7 @@ public function memoizeSystemVariables(array $values)
}

/**
* @param \Illuminate\Database\ConnectionInterface|\Mpyw\LaravelMysqlSystemVariableManager\ManagesSystemVariables $connection
* @param \Illuminate\Database\ConnectionInterface|\Mpyw\LaravelMySqlSystemVariableManager\ManagesSystemVariables $connection
* @return mixed
*/
public function __invoke(ConnectionInterface $connection)
Expand Down
4 changes: 2 additions & 2 deletions tests/BasicVariableAssignmentTest.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace Lampager\Laravel\Tests;
namespace Mpyw\LaravelMySqlSystemVariableManager\Tests;

use Mpyw\LaravelMysqlSystemVariableManager\MySqlConnection;
use Mpyw\LaravelMySqlSystemVariableManager\MySqlConnection;
use PDOException;

class BasicVariableAssignmentTest extends TestCase
Expand Down
4 changes: 2 additions & 2 deletions tests/ReconnectionTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Lampager\Laravel\Tests;
namespace Mpyw\LaravelMySqlSystemVariableManager\Tests;

use Illuminate\Support\Facades\DB;
use Mpyw\LaravelMysqlSystemVariableManager\MySqlConnection;
use Mpyw\LaravelMySqlSystemVariableManager\MySqlConnection;

class ReconnectionTest extends TestCase
{
Expand Down
6 changes: 3 additions & 3 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace Lampager\Laravel\Tests;
namespace Mpyw\LaravelMySqlSystemVariableManager\Tests;

use Illuminate\Support\Facades\DB;
use Mpyw\LaravelMysqlSystemVariableManager\LaravelMysqlSystemVariableManagerServiceProvider;
use Mpyw\LaravelMySqlSystemVariableManager\LaravelMySqlSystemVariableManagerServiceProvider;
use Orchestra\Testbench\TestCase as BaseTestCase;
use PDO;

Expand Down Expand Up @@ -41,7 +41,7 @@ protected function getEnvironmentSetUp($app)
protected function getPackageProviders($app)
{
return [
LaravelMysqlSystemVariableManagerServiceProvider::class,
LaravelMySqlSystemVariableManagerServiceProvider::class,
];
}

Expand Down