phant/client
最新稳定版本:2.4
Composer 安装命令:
composer require phant/client
包简介
Use client easily
关键字:
README 文档
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');
FTP Client
use Phant\Client\Service\Ftp as FtpClient; $ftpClient = new FtpClient( host: 'example.com', username: 'user', password: 'pass', //port: 21 (default) //passiveMode: false (default) ); $files = $ftpClient->listFiles('/path/to/directory'); $downloadedFile = $ftpClient->download('/path/to/remote/file.txt', '/local/directory');
统计信息
- 总下载量: 3.67k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-04-21