https://github.com/josecelano/phpsql
PHP multi database console client
https://github.com/josecelano/phpsql
console database mssql myssql php sql
Last synced: 2 months ago
JSON representation
PHP multi database console client
- Host: GitHub
- URL: https://github.com/josecelano/phpsql
- Owner: josecelano
- Created: 2017-12-22T22:20:17.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-12-22T22:29:47.000Z (over 7 years ago)
- Last Synced: 2025-03-15T00:13:47.340Z (3 months ago)
- Topics: console, database, mssql, myssql, php, sql
- Language: PHP
- Size: 16.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PHP multi database console client
I needed a SQL Server console client on a Linux system and I found this one:
https://github.com/hasankhan/sql-cli
and I decided to do the same for PHP.
## Install
```
git clone [email protected]:josecelano/phpsql.git
cd phpsql
```You can use it in 3 different ways:
## SQL as argument
```
bin/phpsql --user=root --password= --database=homestead --host=127.0.0.1 --port=3306 "show tables"
```## Standard input (pipe)
```
echo "show tables" | bin/phpsql --user=root --password= --database=homestead --host=127.0.0.1 --port=3306
```## Interactive shell
```
bin/phpsql --interactive --user=root --password= --database=homestead --host=127.0.0.1 --port=3306
```## Test
```
composer test
```## TODO
* I had to add the `--interactive` option. Ideally interactive mode should be automatically executed if there are no data from the standard input.
## Output
Output should be something like:
```
C:\Projects\phpsql (master)
λ bin\phpsql.bat --interactive --user=root --password= --database=homestead --host=127.0.0.1 --port=3306
Welcome to interactive php SQL shell. Type 'quit' or 'exit' to exit.
>show tables
+-------------------------+
| Tables_in_homestead |
+-------------------------+
| appliances |
| history |
| history_types |
| migrations |
| password_resets |
| permission_role |
| permissions |
| role_user |
| roles |
| sessions |
| social_logins |
| users |
| wishlist_item_feedbacks |
| wishlists |
+-------------------------+
>
```