PHPackages                             treffynnon/lazyshell - 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. treffynnon/lazyshell

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

treffynnon/lazyshell
====================

Run shell commands from PHP the lazy way

v1.0.0(10y ago)210BSDPHPPHP &gt;5.6

Since Mar 16Pushed 10y ago1 watchersCompare

[ Source](https://github.com/treffynnon/LazyShell)[ Packagist](https://packagist.org/packages/treffynnon/lazyshell)[ Docs](https://github.com/treffynnon/LazyShell)[ RSS](/packages/treffynnon-lazyshell/feed)WikiDiscussions master Synced 3w ago

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

LazyShell
=========

[](#lazyshell)

A lazy way to make shell commands from PHP - handy for use from a REPL for instance. It uses my [CmdWrap](https://github.com/treffynnon/CmdWrap)library underneath to provide the command building and process runners.

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

[](#installation)

```
composer require treffynnon/lazyshell
```

Example
-------

[](#example)

```
Sh::date("'+%Y-%m-%d'"); // date '+%Y-%m-%d'
$listing = Sh::ls('-lkha'); // ls -lkha
```

You can also modify the output by passing in a lambda or closure.

```
Sh::date("'+%Y-%m-%d'", function ($line) {
    return str_replace(date('Y'), '', $line);
})
```

The function is called against each line of output from the command.

Safety
------

[](#safety)

Note that by default arguments will be passed in raw so you need to sanitise them before passing them to LazyShell. If you need escaping then you can pass in any of the [CmdWrap types](https://github.com/treffynnon/CmdWrap#available-command-line-types)instead. I still would not allow user supplied variables go directly into commands though.

```
Sh::date(new Parameter('+%Y-%m-%d')); // date '+%Y-%m-%d'
```

Tests
-----

[](#tests)

Integration testing with phpunit and the code is also linted with `php -l`, phpcs and phpcpd. To run the tests you can use the following composer command:

```
composer test
```

Licence
-------

[](#licence)

BSD 2 clause licence - see LICENCE.md.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

3757d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/65215?v=4)[Simon Holywell](/maintainers/Treffynnon)[@treffynnon](https://github.com/treffynnon)

---

Top Contributors

[![treffynnon](https://avatars.githubusercontent.com/u/65215?v=4)](https://github.com/treffynnon "treffynnon (2 commits)")

---

Tags

consolecommand-lineshellwrappercommand

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/treffynnon-lazyshell/health.svg)

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

###  Alternatives

[symfony/console

Eases the creation of beautiful and testable command line interfaces

9.8k1.1B13.2k](/packages/symfony-console)[psy/psysh

An interactive shell for modern PHP.

9.8k569.8M787](/packages/psy-psysh)[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.7k348.7M10.4k](/packages/nunomaduro-collision)[mrrio/shellwrap

Use any command-line tool as a PHP function.

738210.3k2](/packages/mrrio-shellwrap)[inhere/console

php console library, provide console argument parse, console controller/command run, color style, user interactive, information show.

3487.5k12](/packages/inhere-console)

PHPackages © 2026

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