phant / client
Use client easily
Installs: 1 776
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=8.1
- aws/aws-sdk-php: 3.*
- phant/error: 1.*
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpstan/phpstan: ^1.4
README
Requirments
PHP >= 8.0
Install
composer require phant/client
Usages
MySQL
use Phant\Client\Service\MySQL as ClientMySQL; $clientMySQL = new ClientMySQL( '127.0.0.1', 'my_db', 'my-user', 'my-pass', '3306', 'utf8mb4' ); $clientMySQL->execute( ' INSERT INTO `my_table` SET `col_1` = :val_col_1 , `col_2` = :val_col_2 ', [ ':val_col_1' => 'foo', ':val_col_2' => 'bar', ] ); $list = $clientMySQL->getList( ' SELECT * FROM `my_table` WHERE `col_1` = :val_col_1 , `col_2` = :val_col_2 ', [ ':val_col_1' => 'foo', ':val_col_2' => 'bar', ] ); $list = $clientMySQL->getListByColumnValue( 'my_table', 'col_1', 'foo' ); $item = $clientMySQL->get( ' SELECT * FROM `my_table` WHERE `col_1` = :val_col_1 , `col_2` = :val_col_2 ', [ ':val_col_1' => 'foo', ':val_col_2' => 'bar', ] ); $item = $clientMySQL->getByColumnValue( 'my_table', 'col_1', 'foo' ); $exist = $clientMySQL->get( ' SELECT * FROM `my_table` WHERE `col_1` = :val_col_1 , `col_2` = :val_col_2 ', [ ':val_col_1' => 'foo', ':val_col_2' => 'bar', ] ); $exist = $clientMySQL->existByColumnValue( 'my_table', 'col_1', 'foo' );
S3
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
use Phant\Client\Service\S3 as ClientS3; use Phant\Client\Service\S3\Bucket as ClientS3Bucket; $clientS3Bucket = new ClientS3Bucket( new ClientS3( $region, $endpoint, $accessKey, $secretKey, ), $bucket ); $clientS3Bucket->set('foo', 'bar'); $bar = $clientS3Bucket->get('foo'); $clientS3Bucket->delete('foo');