rreynaldo/baby-cli

There is no license information available for the latest version (dev-main) of this package.

Baby Starter Project

dev-main 2021-09-08 19:35 UTC

This package is auto-updated.

Last update: 2024-04-09 02:05:25 UTC


README

Baby Logo

Install

composer create-project rreynaldo/baby-cli:dev-main my_project_name

Create your first Command in folder src/Commands

<?php

namespace App\Commands;


use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Logger\ConsoleLogger;
use Symfony\Component\Console\Output\OutputInterface;

class AppTestCommand extends Command
{
    protected static $defaultName = 'app:test:command';
    protected ContainerInterface $container;

    /**
     * AppTestCommand constructor.
     */
    public function __construct(ContainerInterface $container)
    {
        parent::__construct();
        $this->container = $container;
    }


    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->container->get('console-logger')->info('Running');
        return Command::SUCCESS;
    }
}

Create your first Scheluder in folder src/Schedules

<?php

namespace App\Commands;


use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Logger\ConsoleLogger;
use Symfony\Component\Console\Output\OutputInterface;

class AppTestCommand extends Command
{
    protected static $defaultName = 'app:test:command';
    protected ContainerInterface $container;

    /**
     * AppTestCommand constructor.
     */
    public function __construct(ContainerInterface $container)
    {
        parent::__construct();
        $this->container = $container;
    }


    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $this->container->get('console-logger')->info('Running');
        return Command::SUCCESS;
    }
}