2017 © Pedro Peláez
 

library cli

IN2PIRE CLI Framework

image

in2pire/cli

IN2PIRE CLI Framework

  • Friday, October 14, 2016
  • by casterx
  • Repository
  • 1 Watchers
  • 2 Stars
  • 201 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 20 Versions
  • 0 % Grown

The README.md

IN2PIRE CLI FRAMEWORK

A Simple PHP CLI Framework provides, (*1)

Installation

Add in2pire/cli to your composer.json and run composer install, (*2)

Structure

  • Application
  • Command
  • Task

TBD, (*3)

Constants

  • APP_NAME: Your app name
  • APP_PATH: Path to your cli application
  • APP_CONF_PATH: Path to directory that stores config files for your application

How to build your cli application

  1. Create project with composer and prepare all the information (or add in2pire/cli to your composer.json)
  2. Prepare config directory and config files. The directory must be inside the project.
  3. Create your cli application. Define needed constants
  4. Add command and task

For examples, (*4)

#!/usr/bin/env php
<?php

/**
 * Memcached CLI Application
 */

if (PHP_SAPI !== 'cli') {
    echo 'Warning: memcached-cli should be invoked via the CLI version of PHP, not the ' . PHP_SAPI . ' SAPI' . PHP_EOL;
    exit(1);
}

define('APP_NAME', 'memcached-cli');
define('APP_PATH', __DIR__);
define('APP_CONF_PATH', APP_PATH . '/../conf/' . APP_NAME);

// Add class loader.
require APP_PATH . '/../vendor/autoload.php';

// Run application.
$app = new In2pire\Cli\CliApplication();
$app->run();

How to compile your cli application

The compiler is distributed in installation directory of in2pire/cli. It uses Phar to put entire application into a single file for easy distribution and installation, (*5)

Arguments * --config: The path to config directory of your cli application * --bin: The path to main executable of your cli application * --no-compress: Do not compress php files * --no-optimize: Do not optimize class loaders * --no-phar: Do not add .phar extension * --executable: Create executable file, (*6)

Requirements * You need to run compiler in your git repository. It helps to detect application version * You need Phar in order to compile your application * zlib or bzip2 is required if you want to reduce size of your binary file, (*7)

For example, in memcached-cli. The binary is compiled by running, (*8)

./bin/compile --bin=bin/memcached-cli --config=conf/memcached-cli --executable --no-phar

Examples

Dependencies

  • PHP >= 5.4
  • Symfony YAML (symfony/yaml) >= 2.6
  • Symfony Console (symfony/console) >= 2.6
  • IN2PIRE Utilities (in2pire/utility) stable version}

Roadmap

  • Better documentation
  • Official website
  • Generator that helps to create class and config files
  • Improve compiler to detect config directory

The Versions

14/10 2016

dev-master

9999999-dev

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

14/10 2016

1.x-dev

1.9999999.9999999.9999999-dev

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

14/10 2016

1.9.0

1.9.0.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

21/06 2015

1.8.0

1.8.0.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

21/06 2015

1.7.0

1.7.0.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

20/05 2015

1.6.0

1.6.0.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

12/05 2015

1.5.1

1.5.1.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

26/04 2015

1.5.0

1.5.0.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

13/04 2015

1.4.3

1.4.3.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

12/04 2015

1.4.2

1.4.2.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

11/04 2015

1.4.1

1.4.1.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

09/04 2015

1.4.0

1.4.0.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

09/03 2015

1.3.0

1.3.0.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

31/01 2015

1.2.4

1.2.4.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

30/01 2015

1.2.3

1.2.3.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

30/01 2015

1.2.2

1.2.2.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

28/12 2014

1.2.1

1.2.1.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

21/12 2014

1.2.0

1.2.0.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

21/12 2014

1.0.1

1.0.1.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire

18/12 2014

1.0.0

1.0.0.0

IN2PIRE CLI Framework

  Sources   Download

MIT

The Requires

 

console cli in2pire inspire