{"id":14970875,"url":"https://github.com/farzai/viola-php","last_synced_at":"2025-10-26T13:31:33.785Z","repository":{"id":169979122,"uuid":"646081686","full_name":"farzai/viola-php","owner":"farzai","description":"Manage your database with ChatGPT","archived":false,"fork":false,"pushed_at":"2024-07-08T14:57:53.000Z","size":498,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-30T04:54:44.463Z","etag":null,"topics":["chatgpt","databases","openai","viola"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/farzai.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"parsilver"}},"created_at":"2023-05-27T08:15:37.000Z","updated_at":"2024-07-08T14:57:49.000Z","dependencies_parsed_at":null,"dependency_job_id":"b5502604-a296-473b-8f44-29a8202baf8a","html_url":"https://github.com/farzai/viola-php","commit_stats":{"total_commits":54,"total_committers":4,"mean_commits":13.5,"dds":"0.37037037037037035","last_synced_commit":"c83403a1042b748b64056c5cea7f519d5629105a"},"previous_names":["farzai/viola-cli-php","farzai/viola-php"],"tags_count":5,"template":false,"template_full_name":"farzai/package-skeleton-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farzai%2Fviola-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farzai%2Fviola-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farzai%2Fviola-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/farzai%2Fviola-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/farzai","download_url":"https://codeload.github.com/farzai/viola-php/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238337483,"owners_count":19455318,"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":["chatgpt","databases","openai","viola"],"created_at":"2024-09-24T13:44:16.860Z","updated_at":"2025-10-26T13:31:33.270Z","avatar_url":"https://github.com/farzai.png","language":"PHP","readme":"# Viola PHP\n\n![Example CLI](assets/example.png)\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/farzai/viola.svg?style=flat-square)](https://packagist.org/packages/farzai/viola)\n[![Tests](https://img.shields.io/github/actions/workflow/status/farzai/viola-php/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/farzai/viola-php/actions/workflows/run-tests.yml)\n[![Total Downloads](https://img.shields.io/packagist/dt/farzai/viola.svg?style=flat-square)](https://packagist.org/packages/farzai/viola)\n\n\nViola is a PHP package that allows you to ask questions to ChatGPT and get the answer with your own data.\n\n## Requirements\n\n- PHP \u003e= 8.0\n- OpenAI Key\n\n## Supported Databases\nCurrently, Viola supports the following databases:\n| Database | Supported |\n|----------|-----------|\n| MySQL    | ✅        |\n| PostgreSQL | ✅        |\n| SQL Server | ✅        |\n| SQLite | ❌        |\n| MongoDB | ❌        |\n\nWait for it!\nI will add support for other databases in the future.\n\n## Installation\n\nYou can install the package globally via composer:\n\n```bash\n$ composer global require farzai/viola\n```\nMake sure to place Composer's system-wide vendor bin directory in your $PATH so the viola executable can be located by your system. \nThis directory exists in different locations based on your operating system;\nhowever, some common locations include:\n\n\nFor macOS\n```\n$HOME/.composer/vendor/bin\n```\n\nFor GNU / Linux Distributions\n```\nGNU / Linux Distributions: $HOME/.config/composer/vendor/bin\n```\n\nFor Windows\n```\n%USERPROFILE%\\AppData\\Roaming\\Composer\\vendor\\bin\n```\n\n## Usage\n\nFirst, you need to set your OpenAI key and Database Connection.\n```bash\n$ viola config\n\n# API Key: \u003cyour-openai-key\u003e\n# Database Connection name: \u003cyour-connection-name\u003e\n# Choose database driver: \u003cmysql|pgsql|sqlsrv\u003e\n# Enter database host, port, database name, username, password\n```\n\nThen, you can try to ask a question to ChatGPT.\n```bash\n$ viola ask \"Show me all books by J. K. Rowling.\"\n```\n\n```bash\nHere, I found 2 books by J. K. Rowling:\n\n|----|------------------------------------------|---------------|------|\n| id | title                                    | author        | year |\n|----|------------------------------------------|---------------|------|\n| 1  | Harry Potter and the Philosopher's Stone | J. K. Rowling | 1997 |\n| 2  | Harry Potter and the Chamber of Secrets  | J. K. Rowling | 1998 |\n|----|------------------------------------------|---------------|------|\n```\n\n\n## Commands\n\n```bash\n# Ask a question to ChatGPT.\n$ viola ask \"\u003cyour-question\u003e\"\n```\n\n```bash\n# Set your OpenAI key and Database Connection.\n$ viola config\n```\n\n```bash\n# Show all database connections.\n$ viola config:show\n```\n\n```bash\n# Change current connection\n$ viola use \u003cconnection-name\u003e\n```\n\n```bash\n# Clear all database connections.\n$ viola config:clear all\n\n# Or clear a specific connection.\n$ viola config:clear \u003cconnection-name\u003e\n```\n\n---\n\n## For Developers\n\n### Installation\n\n1. Install in your project via composer.\n2. Use `Farzai\\Viola\\Viola` class to create a new instance.\n\n```php\nuse Farzai\\Viola\\Viola;\n\n// Setup Viola.\n$viola = Viola::builder()\n    -\u003esetApiKey(string $key)\n    -\u003esetDatabaseConfig(string $driver, array $databaseConfig)\n    -\u003esetClient(\\Psr\\Http\\Client\\ClientInterface $client) // Optional\n    -\u003esetLogger(\\Psr\\Log\\LoggerInterface $logger) // Optional\n    -\u003ebuild();\n\n// Ask a question to ChatGPT.\n$answer = $viola-\u003eask('Show me all books by J. K. Rowling.');\n\n// Get the answer.\necho $answer-\u003egetAnswer();\n\n// Or get the answer with the results.\nforeach ($answer-\u003egetResults() as $row) {\n    //\n}\n```\n\n\n\n## Testing\n\n```bash\n$ composer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [parsilver](https://github.com/parsilver)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","funding_links":["https://github.com/sponsors/parsilver"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarzai%2Fviola-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffarzai%2Fviola-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffarzai%2Fviola-php/lists"}