PHPackages                             farzai/viola - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. farzai/viola

ActiveLibrary[CLI &amp; Console](/categories/cli)

farzai/viola
============

Viola CLI is a command line tool for asking questions with ChatGPT.

1.0.4(3y ago)6352[4 PRs](https://github.com/farzai/viola-php/pulls)MITPHPPHP ^8.0CI passing

Since Jun 21Pushed 1w ago1 watchersCompare

[ Source](https://github.com/farzai/viola-php)[ Packagist](https://packagist.org/packages/farzai/viola)[ Docs](https://github.com/farzai/viola-php)[ GitHub Sponsors](https://github.com/parsilver)[ RSS](/packages/farzai-viola/feed)WikiDiscussions main Synced today

READMEChangelog (5)Dependencies (11)Versions (13)Used By (0)

Viola PHP
=========

[](#viola-php)

[![Example CLI](assets/example.png)](assets/example.png)

[![Latest Version on Packagist](https://camo.githubusercontent.com/74084826f1ee609c892a39b09e023606fd77bd9c97a8375e9b6f065de75611a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6661727a61692f76696f6c612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/farzai/viola)[![Tests](https://camo.githubusercontent.com/7b606f7b1180760018e89920b4b9db005582137cab7d1ecbe69d5180ad1651b0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6661727a61692f76696f6c612d7068702f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/farzai/viola-php/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/0c26487b4cc3234056c7ebb201df3faf42b68b5b0a24889f41994e0795bed777/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6661727a61692f76696f6c612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/farzai/viola)

Viola is a PHP package that allows you to ask questions to ChatGPT and get the answer with your own data.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.0
- OpenAI Key

Supported Databases
-------------------

[](#supported-databases)

Currently, Viola supports the following databases:

DatabaseSupportedMySQL✅PostgreSQL✅SQL Server✅SQLite❌MongoDB❌Wait for it! I will add support for other databases in the future.

Installation
------------

[](#installation)

You can install the package globally via composer:

```
$ composer global require farzai/viola
```

Make sure to place Composer's system-wide vendor bin directory in your $PATH so the viola executable can be located by your system. This directory exists in different locations based on your operating system; however, some common locations include:

For macOS

```
$HOME/.composer/vendor/bin

```

For GNU / Linux Distributions

```
GNU / Linux Distributions: $HOME/.config/composer/vendor/bin

```

For Windows

```
%USERPROFILE%\AppData\Roaming\Composer\vendor\bin

```

Usage
-----

[](#usage)

First, you need to set your OpenAI key and Database Connection.

```
$ viola config

# API Key:
# Database Connection name:
# Choose database driver:
# Enter database host, port, database name, username, password
```

Then, you can try to ask a question to ChatGPT.

```
$ viola ask "Show me all books by J. K. Rowling."
```

```
Here, I found 2 books by J. K. Rowling:

|----|------------------------------------------|---------------|------|
| id | title                                    | author        | year |
|----|------------------------------------------|---------------|------|
| 1  | Harry Potter and the Philosopher's Stone | J. K. Rowling | 1997 |
| 2  | Harry Potter and the Chamber of Secrets  | J. K. Rowling | 1998 |
|----|------------------------------------------|---------------|------|
```

Commands
--------

[](#commands)

```
# Ask a question to ChatGPT.
$ viola ask ""
```

```
# Set your OpenAI key and Database Connection.
$ viola config
```

```
# Show all database connections.
$ viola config:show
```

```
# Change current connection
$ viola use
```

```
# Clear all database connections.
$ viola config:clear all

# Or clear a specific connection.
$ viola config:clear
```

---

For Developers
--------------

[](#for-developers)

### Installation

[](#installation-1)

1. Install in your project via composer.
2. Use `Farzai\Viola\Viola` class to create a new instance.

```
use Farzai\Viola\Viola;

// Setup Viola.
$viola = Viola::builder()
    ->setApiKey(string $key)
    ->setDatabaseConfig(string $driver, array $databaseConfig)
    ->setClient(\Psr\Http\Client\ClientInterface $client) // Optional
    ->setLogger(\Psr\Log\LoggerInterface $logger) // Optional
    ->build();

// Ask a question to ChatGPT.
$answer = $viola->ask('Show me all books by J. K. Rowling.');

// Get the answer.
echo $answer->getAnswer();

// Or get the answer with the results.
foreach ($answer->getResults() as $row) {
    //
}
```

Testing
-------

[](#testing)

```
$ composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [parsilver](https://github.com/parsilver)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance64

Regular maintenance activity

Popularity14

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 65.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

5

Last Release

1106d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4928451?v=4)[parsilver](/maintainers/parsilver)[@parsilver](https://github.com/parsilver)

---

Top Contributors

[![parsilver](https://avatars.githubusercontent.com/u/4928451?v=4)](https://github.com/parsilver "parsilver (56 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (17 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (11 commits)")[![ImgBotApp](https://avatars.githubusercontent.com/u/31427850?v=4)](https://github.com/ImgBotApp "ImgBotApp (1 commits)")

---

Tags

chatgptdatabasesopenaiviolaaiGPT-3openaibotgptChatGptchat gptgpt3farzaiviola-cliviola

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/farzai-viola/health.svg)

```
[![Health](https://phpackages.com/badges/farzai-viola/health.svg)](https://phpackages.com/packages/farzai-viola)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[shopware/storefront

Storefront for Shopware

684.6M236](/packages/shopware-storefront)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M572](/packages/shopware-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M203](/packages/sulu-sulu)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
