PHPackages                             diversen/shell-gpt-php - 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. diversen/shell-gpt-php

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

diversen/shell-gpt-php
======================

Using shell-gpt-php to generate code, system commands, or chat. Easy to extend.

v2.3.4(2y ago)1122MITPHPPHP &gt;=8.1

Since Feb 19Pushed 2y ago1 watchersCompare

[ Source](https://github.com/diversen/shell-gpt-php)[ Packagist](https://packagist.org/packages/diversen/shell-gpt-php)[ RSS](/packages/diversen-shell-gpt-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (43)Used By (0)

shell-gpt-php
=============

[](#shell-gpt-php)

```
cat README.md | shgpt q "Summerize the above README in the style of Shakespeare"

```

Greeting all, 'tis time to install mine shell-gpt-php. 'Tis a wondrous treasure that can assist with thy questions and commands, thine need only download the latest release, execute thine commands, and away we go! Set thy key for the dilaog, or 'tis time to pipe thy content in and generate shell command with or one line python program. Ask a question, or show token usage from thy last ninety days, 'tis all here! Tis a goodly thing all said, so depart thou now, and enjoy thine shell-gpt-php.

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

[](#installation)

Download the latest release:

```
wget https://www.10kilobyte.com/shgpt/shgpt.phar
sudo cp -f shgpt.phar /usr/local/bin/shgpt
sudo chmod +x /usr/local/bin/shgpt
rm shgpt.phar
```

- You may also [build it yourself](docs/BUILD.md)
- Develop [commands](docs/DEVELOP.md)

Set key
-------

[](#set-key)

Set (or change) API key

```
shgpt key

```

### Create a dialog

[](#create-a-dialog)

```
shgpt dialog

```

Or:

```
shgpt d

```

Something like ChatGPT (gpt-3.5-turbo model). Meaning that the answer is extrapolated from the previous questions and answers.

```
You: Say "hello world"
Assistant: Hello world!
You: ...

```

Some sub commands are available in the dialog mode:

```
Available commands:

save  - Save dialog to file
exec  - Execute a command and feed the output to the dialog
exit  - Exit the dialog
comm  - Show all commands
clear - Clear the dialog and start over

Type a message to ChatGPT. Maybe 'hello world!' You may also use above commands.

```

All dialogs are auto-saved on exit to the directory `~/.config/shell-gpt-php/data/`

### Generate a shell command:

[](#generate-a-shell-command)

Command optimized for shell commands.

```
shgpt shell "Command to search replace in files recursive in current directory"
# -> find . -type f -exec sed -i 's/search/replace/g' {} \;

shgpt s "command to change origin of a git repo"
# -> git remote set-url origin

```

Add the -e flag to execute the command:

```
shgpt s "Command to search replace in files recursive in current directory" -e
# -> Execute command: find . -type f -exec sed -i 's/search/replace/g' {} \; ? Sure you want to continue? [Y/n]

```

### Generating code:

[](#generating-code)

Command to generate code snippets.

```
shgpt code "Can you make a simple HTML template?" > index.html
more index.html

shgpt c "Write a one line hello world python program"
# -> print("Hello World!")

```

Ask any question
----------------

[](#ask-any-question)

```
shgpt question "Extract directories from this list of files: $(ls -l)"
# -> bin, src, tests, vendor

shgpt q "What is the distance to the sun? Just show me the number."
# -> 149,597,870.7 kilometers

```

### STDIN

[](#stdin)

The `shell, code, question` commands will accept input from STDIN. STDIN will be added before the prompt. E.g.:

```
cat composer.json | shgpt q "What type of input is this?"
# -> This is a PHP package composer JSON file.

```

### Set params

[](#set-params)

Save some model parameters that will override default params. But not parameters that exists on the command line.

E.g. if you set the temperature to 2.0 you will get kind of crazy results

```
shgpt params -h

```

### Show token usage

[](#show-token-usage)

Last 24 hours, last 7 days, last 30 days and last 90 days.

```
shgpt usage

```

### Export

[](#export)

Export all dialogs as markdown:

```
shgpt export some_dir

```

License
-------

[](#license)

MIT © [Dennis Iversen](https://github.com/diversen)

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~8 days

Recently: every ~64 days

Total

42

Last Release

830d ago

Major Versions

v0.2.0 → v1.0.12023-03-15

v1.2.0 → v2.0.12023-03-23

### Community

Maintainers

![](https://www.gravatar.com/avatar/23ed91d104f16d10414811ecdafbd5c80a660e658d80ccaadf84f512cfb50629?d=identicon)[diversen](/maintainers/diversen)

---

Top Contributors

[![diversen](https://avatars.githubusercontent.com/u/142675?v=4)](https://github.com/diversen "diversen (181 commits)")

---

Tags

chatgptgpt-3shellphpapiclientsdklanguageprocessingshellnaturalcodexGPT-3openai

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/diversen-shell-gpt-php/health.svg)

```
[![Health](https://phpackages.com/badges/diversen-shell-gpt-php/health.svg)](https://phpackages.com/packages/diversen-shell-gpt-php)
```

###  Alternatives

[openai-php/client

OpenAI PHP is a supercharged PHP API client that allows you to interact with the Open AI API

5.8k22.6M232](/packages/openai-php-client)[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[openai-php/symfony

Symfony Bundle for OpenAI

215715.5k3](/packages/openai-php-symfony)

PHPackages © 2026

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