{"id":15041238,"url":"https://github.com/antonioribeiro/sqli","last_synced_at":"2025-04-14T20:15:38.956Z","repository":{"id":15458313,"uuid":"18191377","full_name":"antonioribeiro/sqli","owner":"antonioribeiro","description":"A Laravel Artisan SQL Interactive Interface","archived":false,"fork":false,"pushed_at":"2018-10-10T14:20:26.000Z","size":77,"stargazers_count":60,"open_issues_count":2,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-14T20:15:32.876Z","etag":null,"topics":["databases","laravel","php","sqli","sqlite"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonioribeiro.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-27T21:05:04.000Z","updated_at":"2024-05-20T10:19:45.000Z","dependencies_parsed_at":"2022-08-27T10:01:00.215Z","dependency_job_id":null,"html_url":"https://github.com/antonioribeiro/sqli","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonioribeiro%2Fsqli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonioribeiro%2Fsqli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonioribeiro%2Fsqli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonioribeiro%2Fsqli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonioribeiro","download_url":"https://codeload.github.com/antonioribeiro/sqli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248952355,"owners_count":21188426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["databases","laravel","php","sqli","sqlite"],"created_at":"2024-09-24T20:45:47.829Z","updated_at":"2025-04-14T20:15:38.934Z","avatar_url":"https://github.com/antonioribeiro.png","language":"PHP","funding_links":[],"categories":["Packages"],"sub_categories":["Development Tools"],"readme":"# sqli\r\n\r\n[![Latest Stable Version](https://img.shields.io/packagist/v/pragmarx/sqli.svg?style=flat-square)](https://packagist.org/packages/pragmarx/sqli) [![License](https://img.shields.io/badge/license-BSD_3_Clause-brightgreen.svg?style=flat-square)](LICENSE) [![Downloads](https://img.shields.io/packagist/dt/pragmarx/sqli.svg?style=flat-square)](https://packagist.org/packages/pragmarx/sqli)\r\n\r\nA Laravel 4 \u0026 5 Artisan SQL Interactive Interface, plus a handful of Artisan commands to execute SQL queries.\r\n\r\n## sqli\r\n\r\nIt's like tinker for SQL, just run\r\n\r\n    php artisan sqli\r\n\r\nAnd execute whatever sql query you like in your sql:\r\n\r\n    postgresql:laravel\u003e select email from users;\r\n\r\nAnd you should see it this way:\r\n\r\n    +----+------------------------------+\r\n    | id | email                        |\r\n    +----+------------------------------+\r\n    |  1 | arnold@schwarzenegger.com    |\r\n    |  2 | danny@devito.com             |\r\n    +----+------------------------------+\r\n    Executed in 0.0602 seconds.\r\n\r\nYou can get a list of your tables by running:\r\n\r\n    postgresql:laravel\u003e tables count\r\n\r\n`count` option is optional:\r\n\r\n    +--------------+-----------------------------+-----------+\r\n    | table_schema | table_name                  | row_count |\r\n    +--------------+-----------------------------+-----------+\r\n    | public       | firewall                    | 2         |\r\n    | public       | migrations                  | 3         |\r\n    | public       | sessions                    | 1         |\r\n    | public       | users                       | 1         |\r\n    | public       | actors                      | 3431326   |\r\n    | public       | movies                      | 1764727   |\r\n    +--------------+-----------------------------+-----------+\r\n\r\nYou can view a list of databases:\r\n\r\n    postgresql:laravel\u003e databases\r\n    \r\n    +-----------------+--------+--------------------------+-----------+\r\n    | Connection Name | Driver | Database                 | Host      |\r\n    +-----------------+--------+--------------------------+-----------+\r\n    | postgres        | pgsql  | production               | localhost |\r\n    | tracker         | mysql  | tracker                  | localhost |\r\n    +-----------------+--------+--------------------------+-----------+\r\n\r\nYou can change your current database connection by:\r\n\r\n    postgresql:laravel\u003e database mysql\r\n    mysql:staging\u003e\r\n\r\nYou can list all commands by executing\r\n\r\n    postgresql:laravel\u003e help\r\n\r\n    +----------+------------------------------------------------------------------------------+\r\n    | command  | description                                                                  |\r\n    +----------+------------------------------------------------------------------------------+\r\n    | quit     | Exit interface.                                                              |\r\n    | tables   | List all tables. Use \"tables count\" to list with row count.                  |\r\n    | help     | Show this help.                                                              |\r\n    | database | Change the current database connection. Usage: \"database [connection name]\". |\r\n    +----------+------------------------------------------------------------------------------+\r\n\r\nTo exit, just type `CTRL-C`, `CTRL-D` or `quit`.\r\n\r\n## Other Artisan Commands\r\n\r\nYou don't need to enter sqli to execute commands, you have access to the most common DML commands via direct Artisan commands:\r\n\r\n    select\r\n    insert\r\n    update\r\n    delete\r\n\r\nA special DML command, to execute whatever else you may needd:\r\n\r\n    sql\r\n\r\nAnd a command for listing tables:\r\n\r\n    tables\r\n\r\n## Syntax\r\n\r\nThe syntax could not be simpler, just execute \r\n\r\n    php artisan select email, first_name, last_name from users\r\n\r\nAnd you should get a result like:\r\n\r\n    +----+------------------------------+----------------+----------------+\r\n    | id | email                        | first_name     | last_name      |\r\n    +----+------------------------------+----------------+----------------+\r\n    |  1 | arnold@schwarzenegger.com    | Arnold         | Schwarzenegger |\r\n    |  2 | danny@devito.com             | Danny          | DeVito         |\r\n    +----+------------------------------+----------------+----------------+\r\n\r\nCreate a very small alias for Artisan:\r\n\r\n    alias a='php artisan'\r\n\r\nAnd it'll be as if you where in your sql interface:\r\n\r\n    a select * from posts where post_id \u003c 100\r\n\r\n    a update posts set author_id = 1\r\n\r\n    a delete from posts\r\n\r\n    a sql call removeOldPosts()\r\n\r\n## Command 'table'\r\n\r\nThe command\r\n\r\n    php artisan tables --count\r\n\r\nWill give you a list of your tables with an optional row count:\r\n\r\n    +--------------+-----------------------------+-----------+\r\n    | table_schema | table_name                  | row_count |\r\n    +--------------+-----------------------------+-----------+\r\n    | public       | firewall                    | 2         |\r\n    | public       | migrations                  | 3         |\r\n    | public       | sessions                    | 1         |\r\n    | public       | users                       | 1         |\r\n    | public       | actors                      | 3431326   |\r\n    | public       | movies                      | 1764727   |\r\n    +--------------+-----------------------------+-----------+\r\n\r\n## Too many columns aren't good to look at?\r\n\r\nUse the `less` command to help you with that:\r\n\r\n    a select * from users | less -S\r\n\r\nShould give you a scrollable view of your table:\r\n\r\n    +----+------------------------------+-------------+-----------+--------------------------------------------+---------------------+---------------------+--------------------------------------------------------------+---------------------+----------------+----------------+----------------------------+----------------------------+--------------------------------------------------------------+-----------+-------------+-----------+-----------+-------------+------------+--------------+------------------+-------------------+-----------------+-------------------+-----------------+-----------------+\r\n    | id | email                        | permissions | activated | activation_code                            | activated_at        | last_login          | persist_code                                                 | reset_password_code | first_name     | last_name      | created_at                 | updated_at                 | password                                                     | gender_id | middle_name | nick_name | birth_day | birth_month | birth_year | early_signup | imported_from_id | registration_time | registration_ip | registrated_by_id | activation_time | beta_invitation |\r\n    +----+------------------------------+-------------+-----------+--------------------------------------------+---------------------+---------------------+--------------------------------------------------------------+---------------------+----------------+----------------+----------------------------+----------------------------+--------------------------------------------------------------+-----------+-------------+-----------+-----------+-------------+------------+--------------+------------------+-------------------+-----------------+-------------------+-----------------+-----------------+\r\n    | 38 | arnold@schwarzenegger.com    |             | 1         | V38ScwjCORUvCpuhjkieR4KbnQSlVbhFHujmsyVvN8 | 2014-02-16 14:07:59 | 2014-03-27 18:59:56 | $2y$10$POQ18Kc5JXftOtJswQujBO0PAQ4cfqsSXLKckn9aZOM4VgaExRDHa |                     | Arnold         | Schwarzenegger | 2014-03-29 18:38:39.998522 | 2014-03-27 18:59:56        | $2y$10$5S3KaI6PPHnySECVRwRcferQdiJZP6QgX5adxK7z/WPlxP386HW0e |           |             |           | 31        | 10          |            |              |                  |                   |                 |                   |                 |                 |\r\n    | 40 | clint@eastwood.com           |             |           |                                            |                     |                     |                                                              |                     | Clint          | Eastwood       | 2014-03-29 18:38:39.998522 | 2014-03-29 18:26:17.402382 |                                                              |           |             |           |           |             |            |              |                  |                   |                 |                   |                 |                 |\r\n    | 41 | paul@newman.com              |             |           |                                            |                     |                     |                                                              |                     | Paul           | Newman         | 2014-03-29 18:38:39.998522 | 2014-03-29 18:32:22.489968 |                                                              |           |             |           |           |             |            |              |                  |                   |                 |                   |                 |                 |\r\n    +----+------------------------------+-------------+-----------+--------------------------------------------+---------------------+---------------------+--------------------------------------------------------------+---------------------+----------------+----------------+----------------------------+----------------------------+--------------------------------------------------------------+-----------+-------------+-----------+-----------+-------------+------------+--------------+------------------+-------------------+-----------------+-------------------+-----------------+-----------------+\r\n\r\n## Drawbacks\r\n\r\nWhen passing arguments to scripts Linux based systems may remove quotes and misunderstand your parentheses in queries, you if you need to use them you'll have to double quote it:\r\n\r\n    a insert \"into users (email, first_name, last_name, created_at, updated_at) values ('clint@eastwood.com', 'Clint', 'Eastwood', 'NOW', 'NOW')\"\r\n\r\nor just the parts that have them:\r\n\r\n    a insert into users \"(email, first_name, last_name, created_at, updated_at)\" values \"('clint@eastwood.com', 'Clint', 'Eastwood', 'NOW', 'NOW')\"\r\n\r\nBut you can also escape them with \\\r\n\r\n    a update users set created_at = \\'NOW\\'\r\n\r\n## Command Line Completion\r\n\r\nAll SQL commands, connections, tables names and columns are present in completion, just use TAB to complete your commands.\r\n\r\n## Installation\r\n\r\n### Requirements\r\n\r\n- Laravel 4.1+ / Laravel 5+\r\n\r\n### Installing\r\n\r\nRequire the package using [Composer](https://getcomposer.org/):\r\n\r\n    composer require pragmarx/sqli\r\n\r\nAdd the service provider to your app/config/app.php:\r\n\r\n    'PragmaRX\\Sqli\\Vendor\\Laravel\\ServiceProvider',\r\n\r\n## Author\r\n\r\n[Antonio Carlos Ribeiro](http://twitter.com/iantonioribeiro) \r\n\r\n## License\r\n\r\nsqli is licensed under the BSD 3-Clause License - see the `LICENSE` file for details\r\n\r\n## Contributing\r\n\r\nPull requests and issues are more than welcome.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonioribeiro%2Fsqli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonioribeiro%2Fsqli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonioribeiro%2Fsqli/lists"}