PHPackages                             flsouto/obj2cli - 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. flsouto/obj2cli

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

flsouto/obj2cli
===============

Create Command Line Interfaces from PHP Objects

1.0.2(9y ago)022PHP

Since Oct 24Pushed 9y agoCompare

[ Source](https://github.com/flsouto/obj2cli)[ Packagist](https://packagist.org/packages/flsouto/obj2cli)[ RSS](/packages/flsouto-obj2cli/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (4)Used By (0)

obj2cli
=======

[](#obj2cli)

Overview
--------

[](#overview)

This library allows you to create an interactive shell application from a plain php object. Commands are routed to instance methods, and command arguments are passed over as method arguments.

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

[](#installation)

You can simply download obj2cli.php file to your project's folder or install it via composer:

```
composer require flsouto/obj2cli

```

*Notice*: in both cases you will have to include the file manually, since it will not be autoloaded!

Usage
-----

[](#usage)

Let's say we want to create an app that has two available commands:

- say\_hello - prints "hello" to stdout
- say - which takes a parameter and prints it

This is how you could implement it using obj2cli:

```
