Skip to content

Commit

Permalink
better namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
andkom committed Sep 15, 2018
1 parent 63f3b64 commit 51bae5c
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 38 deletions.
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM php:7.2-cli

RUN apt-get update && apt-get install -y libdb5.3++-dev

RUN curl -O --referer https://fossies.org/linux/misc/db-18.1.25.tar.gz/ \
https://fossies.org/linux/misc/db-18.1.25.tar.gz \
&& tar -zxf db-18.1.25.tar.gz && cd db-18.1.25/lang/php_db4/ \
&& phpize \
&& ./configure --with-db4 \
&& make \
&& make install \
&& docker-php-ext-enable db4

RUN curl -O http://download.oracle.com/berkeley-db/db-4.8.30.tar.gz \
&& tar -zxf db-4.8.30.tar.gz \
&& cd db-4.8.30/build_unix \
&& ../dist/configure --enable-cxx \
&& make \
&& make install \
&& cd ../../

RUN docker-php-ext-configure dba --with-db4=/usr/local/BerkeleyDB.4.8 \
&& docker-php-ext-install dba
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ composer install andkom/php-berkeley-db
**Create instance:**

```PHP
use AndKom\PhpBerkeleyDb\Adapter\AdapterFactory;
use AndKom\BerkeleyDb\Adapter\AdapterFactory;

$adapter = AdapterFactory::create(); // use first available adapter
$adapter = AdapterFactory::create("phpdb4"); // use phpdb4 adapter
Expand Down Expand Up @@ -139,7 +139,7 @@ foreach ($adapter->read() as $key => $value) {
**Publish configuration to app config:**

```bash
./artisan vendor:publish --provider=AndKom\\PhpBerkeleyDb\\ServiceProvider
./artisan vendor:publish --provider=AndKom\\BerkeleyDb\\ServiceProvider
```

**Edit app/config/berkeleydb.php:**
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@
},
"autoload": {
"psr-4": {
"AndKom\\PhpBerkeleyDb\\": "src/"
"AndKom\\BerkeleyDb\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"AndKom\\PhpBerkeleyDb\\Tests\\": "tests/"
"AndKom\\BerkeleyDb\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"AndKom\\PhpBerkeleyDb\\ServiceProvider"
"AndKom\\BerkeleyDb\\ServiceProvider"
],
"aliases": {
"BDB": "AndKom\\PhpBerkeleyDb\\Facade\\BDB"
"BDB": "AndKom\\BerkeleyDb\\Facade\\BDB"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Adapter/AbstractAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb\Adapter;
namespace AndKom\BerkeleyDb\Adapter;

use AndKom\PhpBerkeleyDb\Exception;
use AndKom\BerkeleyDb\Exception;

/**
* Class AbstractAdapter
* @package AndKom\PhpBerkeleyDb\Adapter
* @package AndKom\BerkeleyDb\Adapter
*/
abstract class AbstractAdapter implements AdapterInterface
{
Expand Down
4 changes: 2 additions & 2 deletions src/Adapter/AdapterFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb\Adapter;
namespace AndKom\BerkeleyDb\Adapter;

/**
* Class AdapterFactory
* @package AndKom\PhpBerkeleyDb\Adapter
* @package AndKom\BerkeleyDb\Adapter
*/
class AdapterFactory
{
Expand Down
6 changes: 3 additions & 3 deletions src/Adapter/AdapterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb\Adapter;
namespace AndKom\BerkeleyDb\Adapter;

use AndKom\PhpBerkeleyDb\Exception;
use AndKom\BerkeleyDb\Exception;

/**
* Interface AdapterInterface
*
* @package AndKom\PhpBerkeleyDb\Adapter
* @package AndKom\BerkeleyDb\Adapter
*/
interface AdapterInterface
{
Expand Down
6 changes: 3 additions & 3 deletions src/Adapter/DbaAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb\Adapter;
namespace AndKom\BerkeleyDb\Adapter;

use AndKom\PhpBerkeleyDb\Exception;
use AndKom\BerkeleyDb\Exception;

// check whether dba extension is loaded
if (!extension_loaded('dba')) {
Expand All @@ -18,7 +18,7 @@

/**
* Wrapper for db4 DBA handler
* @package AndKom\PhpBerkeleyDb\Adapter
* @package AndKom\BerkeleyDb\Adapter
*/
class DbaAdapter extends AbstractAdapter
{
Expand Down
6 changes: 3 additions & 3 deletions src/Adapter/PhpDb4Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb\Adapter;
namespace AndKom\BerkeleyDb\Adapter;

use AndKom\PhpBerkeleyDb\Exception;
use AndKom\BerkeleyDb\Exception;

// check whether php_db4 extension is loaded
if (!class_exists('\Db4')) {
Expand All @@ -18,7 +18,7 @@

/**
* Wrapper for ext-db4
* @package AndKom\PhpBerkeleyDb\Adapter
* @package AndKom\BerkeleyDb\Adapter
*/
class PhpDb4Adapter extends AbstractAdapter
{
Expand Down
4 changes: 2 additions & 2 deletions src/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb;
namespace AndKom\BerkeleyDb;

/**
* Class Exception
* @package AndKom\PhpBerkeleyDb
* @package AndKom\BerkeleyDb
*/
class Exception extends \Exception
{
Expand Down
4 changes: 2 additions & 2 deletions src/Facade/BDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb\Facade;
namespace AndKom\BerkeleyDb\Facade;

use Illuminate\Support\Facades\Facade;

/**
* Class BDB
* @package AndKom\PhpBerkeleyDb\Facade
* @package AndKom\BerkeleyDb\Facade
*/
class BDB extends Facade
{
Expand Down
8 changes: 4 additions & 4 deletions src/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb;
namespace AndKom\BerkeleyDb;

use AndKom\PhpBerkeleyDb\Adapter\AdapterFactory;
use AndKom\PhpBerkeleyDb\Adapter\AdapterInterface;
use AndKom\BerkeleyDb\Adapter\AdapterFactory;
use AndKom\BerkeleyDb\Adapter\AdapterInterface;

/**
* Class Manager
* @package AndKom\PhpBerkeleyDb
* @package AndKom\BerkeleyDb
*/
class Manager
{
Expand Down
4 changes: 2 additions & 2 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb;
namespace AndKom\BerkeleyDb;

/**
* Class ServiceProvider
* @package AndKom\PhpBerkeleyDb
* @package AndKom\BerkeleyDb
*/
class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
Expand Down
4 changes: 2 additions & 2 deletions tests/AdapterAbstractTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb\Tests;
namespace AndKom\BerkeleyDb\Tests;

use AndKom\PhpBerkeleyDb\Adapter\AdapterInterface;
use AndKom\BerkeleyDb\Adapter\AdapterInterface;
use PHPUnit\Framework\TestCase;

abstract class AdapterAbstractTest extends TestCase
Expand Down
6 changes: 3 additions & 3 deletions tests/DbaAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb\Tests;
namespace AndKom\BerkeleyDb\Tests;

use AndKom\PhpBerkeleyDb\Adapter\AdapterFactory;
use AndKom\PhpBerkeleyDb\Adapter\AdapterInterface;
use AndKom\BerkeleyDb\Adapter\AdapterFactory;
use AndKom\BerkeleyDb\Adapter\AdapterInterface;

class DbaAdapterTest extends AdapterAbstractTest
{
Expand Down
6 changes: 3 additions & 3 deletions tests/PhpDb4AdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

declare(strict_types=1);

namespace AndKom\PhpBerkeleyDb\Tests;
namespace AndKom\BerkeleyDb\Tests;

use AndKom\PhpBerkeleyDb\Adapter\AdapterFactory;
use AndKom\PhpBerkeleyDb\Adapter\AdapterInterface;
use AndKom\BerkeleyDb\Adapter\AdapterFactory;
use AndKom\BerkeleyDb\Adapter\AdapterInterface;

class PhpDb4AdapterTest extends AdapterAbstractTest
{
Expand Down

0 comments on commit 51bae5c

Please sign in to comment.