PHPackages                             mafuth/php-cli - 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. mafuth/php-cli

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

mafuth/php-cli
==============

About simple command line interface and framework for PHP focuesed on light weight and simplicity

3.2(3y ago)4542MITPHP

Since Sep 17Pushed 7mo ago1 watchersCompare

[ Source](https://github.com/mafuth/php-CLI)[ Packagist](https://packagist.org/packages/mafuth/php-cli)[ Docs](https://github.com/mafuth/php-CLI)[ RSS](/packages/mafuth-php-cli/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

[![Contributors](https://camo.githubusercontent.com/f387b6c88b298b83603f668c482de96587bf91c6fb27b2c8303d7b634291a7d2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f6e7472696275746f72732d3933623032333f7374796c653d666f722d7468652d6261646765266c6f676f3d436f6e7472696275746f7273266c6f676f436f6c6f723d7768697465)](https://github.com/mafuth/php-CLI/contributors)[![Forks](https://camo.githubusercontent.com/7652d8e76deccb002f4348a00e3545d911a01b3628bc7d03753da5f376674fa8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f466f726b732d3933623032333f7374796c653d666f722d7468652d6261646765266c6f676f3d466f726b73266c6f676f436f6c6f723d7768697465)](https://github.com/mafuth/php-CLI/fork)[![Stargazers](https://camo.githubusercontent.com/b17a23e60d8d608e68eca765a6d027b3a02258606a4f0052abc490b8f0494985/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53746172732d3933623032333f7374796c653d666f722d7468652d6261646765266c6f676f3d5374617273266c6f676f436f6c6f723d7768697465)](https://github.com/mafuth/php-CLI/)[![Issues](https://camo.githubusercontent.com/afd505c11815c1020c1ca6ac7601aa7fb2e5001f717bd413898374eae5044242/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4973737565732d4646413530303f7374796c653d666f722d7468652d6261646765266c6f676f3d497373756573266c6f676f436f6c6f723d7768697465)](https://github.com/mafuth/php-CLI/issues)

[![](https://camo.githubusercontent.com/b34234f1c8738f0c573db8c0574b78dddc63527c4b4bf4bad5407590f7596322/68747470733a2f2f646576656c6f7065722e6665646f726170726f6a6563742e6f72672f7374617469632f6c6f676f2f636c692d6170702e706e67)](https://camo.githubusercontent.com/b34234f1c8738f0c573db8c0574b78dddc63527c4b4bf4bad5407590f7596322/68747470733a2f2f646576656c6f7065722e6665646f726170726f6a6563742e6f72672f7374617469632f6c6f676f2f636c692d6170702e706e67)php-CLI
=======

[](#php-cli)

 This project requires **PHP as an executable command**

Installation
============

[](#installation)

1. Create a project ```
    composer create-project mafuth/php-cli:dev-main test
    ```
2. Check for installation ```
    php cli --v
    ```
3. Configure the installation ```
    php cli --config
    ```
4. test connection to database ```
    php cli test data-base-connection
    ```
5. Start a local server ```
    php cli --serve
    ```

ajax folder
===========

[](#ajax-folder)

This is where cli generates ajax request files

comands folder
==============

[](#comands-folder)

This is where cli generates all you run command files

database folder
===============

[](#database-folder)

inside database/create is all the cli generates database table controllers

handlers folder
===============

[](#handlers-folder)

This is where cli generates handle files

views folder
============

[](#views-folder)

This is where you put you php code files that generate views on the front end

index and main files
====================

[](#index-and-main-files)

Please do not edit these files as these are important components

requests file
=============

[](#requests-file)

This file handles all the requests to the server, edit this file as needed

To disable minification change request file compiler like shown below
---------------------------------------------------------------------

[](#to-disable-minification-change-request-file-compiler-like-shown-below)

```
echo $COMPILER->output($PAGE,false);
```

If you want to use blade templating engine you can check documentation of [BladeOne](https://github.com/EFTEC/BladeOne)
-----------------------------------------------------------------------------------------------------------------------

[](#if-you-want-to-use-blade-templating-engine-you-can-check-documentation-of-bladeone)

config.ini file
===============

[](#configini-file)

This is the main config file of the server

```
[app configs]
appname = "Your App Name"
port = "8080" #Your app port default to 8080

[database configs]
servername = "Your database server here"
username = "server username"
password = "server password"
dbname = "database name"

[Mail server]
mailServer = "Your mailserver here"
mailUsername = "server username"
mailPassword = "servr password"
mailport = "server port"

[encryption keys]
KEY_ONE = "encryption key 1"
KEY_TWO = "encryption key 2"

[maintanance mode]
maintanance = false # true or false

[error reporting]
error = false # true or false

[auto ssl]
autossl = false # true or false (true will force ssl on every request)

```

Usage
=====

[](#usage)

### git commands

[](#git-commands)

1. Configure git

```
git config --global user.name "Full Name as on github"
```

```
git config --global user.email "Email as on github"
```

On the next step press Enter to choose the default value

```
ssh-keygen -t rsa -C "Email as on github"
```

windows

```
notepad ~/.ssh/id_rsa.pub
```

mac &amp; linux

```
cat ~/.ssh/id_rsa.pub
```

Now go to  and add the key you just generated / opened on note pad , save the ssh keys

2. Test git

```
ssh -T git@github.com
```

If you see a message like 'Hi user! You've successfully authenticated, but GitHub does not provide shell access.' then everything is okay

```
php cli --git
```

### create command

[](#create-command)

Create a database table (replace '-- your table name --' with any name of your choice)

```
php cli create table -- your table name --
```

Create a handler for post request (replace '-- your handler name --' with any name of your choice)

```
php cli create handler -- your handler name --
```

Create a ajax request handler for all xml requests (replace '-- your handler name --' with any name of your choice)

```
php cli create ajax -- your handler name --
```

Create a new run command (replace '-- your command name --' with any name of your choice)

```
php cli create run-command -- your command name --
```

### Data base tables command

[](#data-base-tables-command)

Drop all tables and delete create function files

```
php cli drop-tables
```

or use

```
php cli drop-table -- your table name --
```

if want edit a table layout just edit the table lay out file at (database/create) directory and run the command below

```
php cli recreate-tables
```

or use

```
php cli recreate-table -- your table name --
```

### run command

[](#run-command)

This command is used to run scripts created using (php cli create run-command -- your command name -- )

```
php cli run -- your command name --
```

### building Database queries ( reffer to 'classes/db.class.php' )

[](#building-database-queries--reffer-to-classesdbclassphp-)

select from

```
$DB->selectFrom($table);
$data = $DB->execute(); // this will return an array of all data selected;
```

select from where

```
$DB->selectFrom($table);
$DB->where(array(
  'id'=>1,
  'name'=>array(
      'john',
      'doe'
  )
));
$data = $DB->execute(); // this will return an array of all data selected;
```

delete from

```
$DB->deleteFrom($table);
$DB->where(array(
  'id'=>1,
  'name'=>array(
      'john',
      'doe'
  )
));
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message
```

update from

```
$DB->updateFrom($table);
$DB->set(array(
  'name'=>'john'
));
$DB->where(array(
  'id'=>1
));
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message
```

insert to

```
$DB->insert(array(
  'john'
));
$DB->to($table);
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message

$DB->insertTo($table,array(
  'name'=>'john'
));
$data = $DB->execute(); // this will return true if successful and false if failed
$error = $data['message]; // this has the error message
```

### PWA command

[](#pwa-command)

This command is used generate PWA code for ur website this command requires [node js](https://nodejs.org/en/download/) and [pwa asset generator by onderceylan](https://github.com/onderceylan/pwa-asset-generator)
PWA also supports [onesignal SDK](https://github.com/mafuth/onesignal-sdk) which is also included in php-CLI

```
php cli pwa-code
```

### Composer commands

[](#composer-commands)

Install new composer packeges (replace '-- package name --' with any composer package of your choice)

```
php cli install -- package name --
```

### Ftp deploy from github

[](#ftp-deploy-from-github)

Setup github workflow to easily deploy your websites to your servers using ftp or sftp

```
php cli --git make ftp deploy
```

```
php cli --git make sftp deploy
```

### Docker

[](#docker)

Setup a full docker enviroment for development

```
php cli make docker container
```

### Database Backup

[](#database-backup)

Backup your database

```
php cli db backup
```

restore your database from backup

```
php cli db restore
```

Contributing
============

[](#contributing)

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance44

Moderate activity, may be stable

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 99.3% 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

2

Last Release

1336d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8be24951efd19c0091e65d1637bae1465d8786f73ccd188c749cc127ee5b413b?d=identicon)[mafuth](/maintainers/mafuth)

---

Top Contributors

[![mafuth](https://avatars.githubusercontent.com/u/57235839?v=4)](https://github.com/mafuth "mafuth (134 commits)")[![Z3d0X](https://avatars.githubusercontent.com/u/75579178?v=4)](https://github.com/Z3d0X "Z3d0X (1 commits)")

---

Tags

beginnerclieasyframeworkhacktoberfestnewoopphpsimpletemplate

### Embed Badge

![Health badge](/badges/mafuth-php-cli/health.svg)

```
[![Health](https://phpackages.com/badges/mafuth-php-cli/health.svg)](https://phpackages.com/packages/mafuth-php-cli)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

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