Skip to content

Commit

Permalink
Merge pull request #1 from PhantPHP/v2
Browse files Browse the repository at this point in the history
V2
  • Loading branch information
lennyrouanet authored May 18, 2023
2 parents 59f6a54 + 28ae47b commit 10b50ca
Show file tree
Hide file tree
Showing 11 changed files with 361 additions and 177 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ test/coverage
# Dev
.DS_Store
.nova/*
.php-cs-fixer.cache
29 changes: 24 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ PHP >= 8.0
### MySQL

```php
use Phant\Client\MySQL as ClientMySQL;
use Phant\Client\Service\MySQL as ClientMySQL;

$clientMySQL = new ClientMySQL(
'127.0.0.1',
Expand Down Expand Up @@ -99,16 +99,35 @@ $exist = $clientMySQL->existByColumnValue(
### S3

```php
use Phant\Client\S3 as ClientS3;
use Phant\Client\Service\S3 as ClientS3;

$clientS3 = new ClientS3(
$region,
$endpoint,
$accessKey,
$secretKey,
);
$clientS3->setObject($bucket, 'foo', 'bar');
$bar = $clientS3->getObject($bucket, 'foo');
$clientS3->deleteObject($bucket, 'foo');
```

### S3 Bucket

```php
use Phant\Client\Service\S3 as ClientS3;
use Phant\Client\Service\S3\Object as ClientS3Object;

$clientS3Object = new ClientS3Object(
new ClientS3(
$region,
$endpoint,
$accessKey,
$secretKey,
),
$bucket
);
$clientS3->set('foo', 'bar');
$bar = $clientS3->get('foo');
$clientS3->delete('foo');
$clientS3Object->set('foo', 'bar');
$bar = $clientS3Object->get('foo');
$clientS3Object->delete('foo');
```
108 changes: 0 additions & 108 deletions component/MySQL.php

This file was deleted.

46 changes: 46 additions & 0 deletions component/Port/MySQL.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

declare(strict_types=1);

namespace Phant\Client\Port;

interface MySQL
{
public function execute(
string $query,
array $values = []
): void;

public function getList(
string $query,
array $values = []
): array;

public function getListByColumnValue(
string $table,
string $column,
string|int|float|bool $value
): array;

public function get(
string $query,
array $values = []
): array;

public function getByColumnValue(
string $table,
string $column,
string|int|float|bool $value
): array;

public function exist(
string $query,
array $values = []
): bool;

public function existByColumnValue(
string $table,
string $column,
string|int|float|bool $value
): bool;
}
24 changes: 24 additions & 0 deletions component/Port/S3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace Phant\Client\Port;

interface S3
{
public function setObject(
string $bucket,
string $key,
string $body
): void;

public function getObject(
string $bucket,
string $key
): string;

public function deleteObject(
string $bucket,
string $key
): void;
}
21 changes: 21 additions & 0 deletions component/Port/S3/Object.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

namespace Phant\Client\Port\S3;

interface Object
{
public function set(
string $key,
string $body
): void;

public function get(
string $key
): string;

public function delete(
string $key
): void;
}
62 changes: 0 additions & 62 deletions component/S3.php

This file was deleted.

Loading

0 comments on commit 10b50ca

Please sign in to comment.