承接 slam/mysql-php 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

slam/mysql-php

最新稳定版本:v1.1.0

Composer 安装命令:

composer require slam/mysql-php

包简介

PHP version of mysql cli that comes with MySQL

关键字:

README 文档

README

Latest Stable Version Downloads Integrate Code Coverage

PHP light version of mysql cli that comes with MySQL.

Why

  1. You are inside a PHP only environment, like a PHP Docker image
  2. You need to import a large mysql dump
  3. You don't have access to the native mysql client

Performance

Speed is exactly the same of the original mysql binary thanks to streams usage.

Supported formats

Usage

The library provides two usages, the binary and the \SlamMysql\Mysql class.

From CLI

$ ./mysql -h
Usage: mysql [OPTIONS]
  --host       Connect to host     [Default: INI mysqli.default_host]
  --port       Port number         [Default: INI mysqli.default_port]
  --username   User for login      [Default: INI mysqli.default_user]
  --password   Password to use     [Default: INI mysqli.default_pw]
  --database   Database to use     [Default: empty]
  --socket     The socket file     [Default: INI mysqli.default_socket]

$ printf "CREATE DATABASE foobar;\nSHOW DATABASES;" | ./mysql
information_schema
foobar
mysql
performance_schema
sys

$ ./mysql --database foobar < foobar_huge_dump.sql

From PHP

$mysql = new \SlamMysql\Mysql('localhost', 'root', 'pwd', 'my_database', 3306, '/socket');
$return = $mysql->run(\STDIN, \STDOUT, \STDERR);
exit((int) (true !== $return));

\SlamMysql\Mysql::run accepts any type of resource consumable by fgets/fwrite functions.

Related projects

  1. ifsnop/mysqldump-php: mysqldump binary port in pure PHP

统计信息

  • 总下载量: 24.31k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-07-17