PHPackages                             nazmulpcc/phpsh - 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. nazmulpcc/phpsh

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

nazmulpcc/phpsh
===============

Generate shell scripts from PHP with ease

0.1(5y ago)121MITPHPPHP ^7.0

Since Jul 5Pushed 4y ago2 watchersCompare

[ Source](https://github.com/nazmulpcc/phpsh)[ Packagist](https://packagist.org/packages/nazmulpcc/phpsh)[ Docs](https://github.com/nazmulpcc/phpsh)[ RSS](/packages/nazmulpcc-phpsh/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

PhpSh
=====

[](#phpsh)

[![Latest Version on Packagist](https://camo.githubusercontent.com/e96a96d41cbda11be27ca04a1333c28e624627ce5c2c50c1ee3e6323da90b271/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e617a6d756c7063632f70687073682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nazmulpcc/phpsh)[![GitHub Tests Action Status](https://camo.githubusercontent.com/80967533bba116af6feea5bebefa42800e3c59966267c05772c869f756e6c986/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6e617a6d756c7063632f70687073682f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/nazmulpcc/phpsh/actions?query=workflow%3Arun-tests+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/a17f4db26fe1eb8ce6155db46a0711e745cdf01ade7ccdb8a3a53ff53e4915aa/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6e617a6d756c7063632f70687073682e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/nazmulpcc/phpsh)

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

[](#installation)

You can install the package via composer:

```
composer require nazmulpcc/phpsh
```

Why?
----

[](#why)

If writing shell scripts make you *uncomfortable* because it feels like an ecrypted alient language, PhpSh is for you.

Examples
--------

[](#examples)

```
use PhpSh\Condition;
use PhpSh\Script;

$condition = Condition::create('$i')->lessThan(10);

(new Script())
    ->set('i', 0)
    ->while($condition, function (Script $script){
        $script->echo('$i');
        $script->increment('i');
    })
    ->generate();
```

The above example code will generate shell executable script like this:

```
i=0
while [ $i -lt 10 ]; do
    echo -n $i
    let i+=1
done
```

Don't know how to do "if a file exists and is writable then do something"? PhpSh got your back!

```
$condition = Condition::create()
    ->fileExists('/path/to/file')
    ->and()
    ->writable('/path/to/file');

(new Script())
    ->if($condition, function (Script $script){
        $script->printf("File found\n");
    })->else(function (Script $script){
        $script->printf("Oops!\n");
    })
    ->generate();
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email nazmulpcc \[at\] gmail.com instead of using the issue tracker.

Credits
-------

[](#credits)

- [Nazmul Alam](https://github.com/nazmulpcc)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2140d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3b1e7c1c1099138d6409a43382e39b6ef728469af42e6c1cab4715eb01bf1acf?d=identicon)[nazmul](/maintainers/nazmul)

---

Top Contributors

[![nazmulpcc](https://avatars.githubusercontent.com/u/8166346?v=4)](https://github.com/nazmulpcc "nazmulpcc (7 commits)")

---

Tags

bashphpshell-scriptphpshellbashbash-scriptshell-script

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nazmulpcc-phpsh/health.svg)

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

###  Alternatives

[seregazhuk/php-watcher

Automatically restart PHP application once the source code changes

394137.8k4](/packages/seregazhuk-php-watcher)[alecrabbit/php-console-spinner

Extremely flexible spinner for \[async\] php cli applications

24032.0k2](/packages/alecrabbit-php-console-spinner)[merlinthemagic/mts

PHP Automation Tools

1144.5k](/packages/merlinthemagic-mts)[dawood/phpchromepdf

A slim PHP wrapper around google-chrome to convert url to pdf or to take screenshots , easy to use and clean OOP interface

14980.5k](/packages/dawood-phpchromepdf)[stepanenko3/nova-command-runner

Laravel Nova tool for running Artisan and bash(shell) commands.

36983.0k](/packages/stepanenko3-nova-command-runner)[ollyxar/php-malware-detector

PHP malware detector

12926.4k](/packages/ollyxar-php-malware-detector)

PHPackages © 2026

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