Skip to content

A simple library to work with Symfony Console Component and Symfony Dependency Injection Component

Notifications You must be signed in to change notification settings

luismulinari/consoleful

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Consoleful

A simple library to work with Symfony Console Component and Symfony Dependency Injection Component

======= Latest Stable Version Build Status Scrutinizer Code Quality Code Coverage

Instalation

Use composer to add consoleful to your app

"luismulinari/consoleful": "*"

Usage (example)

application.php - Entry Point

<?php
use Lcobucci\DependencyInjection\ContainerConfig;
use LuisMulinari\Consoleful\Application;

$autoloader = require __DIR__ . '/vendor/autoload.php';

$application = new Application(
    'Application name',
    'Version',
    new ContainerConfig(__DIR__ . 'services.xml') // services.[xml|yml|php]
);

$application->add(new ExampleCommand());

$application->run();

ExampleCommand.php - Command file

<?php

namespace Vendor\ExampleApp\Command;

use LuisMulinari\Consoleful\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;

class ExampleCommand extends ContainerAwareCommand
{
    protected function configure()
    {
        $this->setName("example");
        $this->setDescription('Description example');
    }
    
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $container = $this->getContainer();
        
        $container->get('service.example');
        $container->getParameter('parameter.example');
    }
}

You can see other examples here

About

A simple library to work with Symfony Console Component and Symfony Dependency Injection Component

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages