Skip to content

It is a simple helper library that will allow you to write your console/cli application with PHP.

License

Notifications You must be signed in to change notification settings

InitPHP/Console

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Console

It is a simple helper library that will allow you to write your console/cli application with PHP.

Requirements

  • PHP 7.2 or higher

Installation

composer require initphp/console

Usage

#!/usr/bin/env php
<?php
require_once __DIR__ . '/../vendor/autoload.php';
use \InitPHP\Console\{Application, Input, Output};

$console = new Application("My Console Application", '1.0');

// Register commands ...

// hello -name=John
$console->register('hello', function (Input $input, Output $output) {
    if ($input->hasArgument('name')) {
        $output->writeln('Hello {name}', [
            'name'  => $input->getArgument('name')
        ]);
    } else {
        $output->writeln('Hello World!');
    }
}, 'Says hello.');


$console->run();
php console.php list

Credits

License

Copyright © 2022 MIT License

About

It is a simple helper library that will allow you to write your console/cli application with PHP.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages