2017 © Pedro Peláez
 

library slic

Command Line Interface Micro Framework based on Symfony2 Components

image

siphoc/slic

Command Line Interface Micro Framework based on Symfony2 Components

  • Thursday, November 8, 2012
  • by jelmersnoeck
  • Repository
  • 4 Watchers
  • 1 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Slic

Slic is a micro framework build to help you execute actions on the command line., (*1)

Build Status, (*2)

Installation

  • Install Composer
  • Run composer.phar install
  • Optional: run ./compile (This'll allow you to use a .phar package)

Already have composer installed?

git clone git@github.com:siphoc/Slic.git && cd Slic && composer.phar install

Install into existing project

To install Slic into an existing application, you can add it to your composer.json., (*3)

"require":{
    "php": ">=5.3.2",
    "siphoc/slic": "dev-master"
},

Run composer.phar update to install Slic and it's dependencies., (*4)

Usage

This is a demo example:, (*5)

<?php

require_once __DIR__ . '/slic.phar';

use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputOption;

class MockCommand extends \Slic\Command\Command
{
    public function configure()
    {
        $this->setDescription('Test command')
            ->addArgument(
                'name', InputArgument::REQUIRED, 'What\'s your name?'
            )
            ->addOption(
                'uppercase', null,
                InputOption::VALUE_NONE, 'Show in uppercase?'
            )
        ;
    }

    public function execute(InputInterface $input, OutputInterface $output)
    {
        $outputText = 'Hello, ';

        $outputText .= $input->getArgument('name');

        if ($input->getOption('uppercase')) {
            $outputText = strtoupper($outputText);
        }

        $output->writeln($outputText);
    }
}

$app = new \Slic\Application('slic');
$app->registerCommand(new MockCommand('slic:mock'));
$app->run();

Here we'll create a command mock (you can create as much commands as you want.) and configure it's description and arguments/options/actions., (*6)

Then you only need to register these commands so that they'll be available trough your script., (*7)

Todo

  • Extra default services
    • Doctrine
    • Monolog
  • Commands via config

The Versions

08/11 2012

dev-master

9999999-dev http://siphoc.github.com/slic

Command Line Interface Micro Framework based on Symfony2 Components

  Sources   Download

MIT

The Requires

 

cli symfony microframework