2017 © Pedro Peláez
 

composer-plugin composer-custom-commands

Adds possibility to define console commands as composer commands with Symfony console component syntax

image

imponeer/composer-custom-commands

Adds possibility to define console commands as composer commands with Symfony console component syntax

  • Thursday, July 5, 2018
  • by MekDrop
  • Repository
  • 3 Watchers
  • 0 Stars
  • 429 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 3 Versions
  • 29 % Grown

The README.md

License PHP from Packagist, (*1)

Composer Custom Commands

Composer plugin that adds a possibility to define console commands as composer commands with Symfony console component syntax., (*2)

Usage

To start using this plugin you need just to do 4 easy steps:, (*3)

1. Add plugin into your composer project:

Easiest way to do that is to execute composer command from console:, (*4)

composer require imponeer/composer-custom-commands

2. Create class that that implements new command

It should be look something like this:, (*5)

namespace My\Commands;

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

/**
 * Your new command
 */
class DummyCommand extends Command
{

    /**
     * Here we can configure command name, options and arguments.
     * We using here Symfony Command syntax.
     */
    protected function configure()
    {

    }

    /**
     * Execute command
     *
     * @param InputInterface $input STDInput
     * @param OutputInterface $output SRDOutput
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {

    }

}

3. Create or edit config section in projects composer.json and add there section custom-commands with commands key and add there PHP class names of commands that should be added to composer

This should look something like this:, (*6)

{
    "name": "my-project",
    "description": "",
    "type": "project",
    "require": {
        "imponeer/composer-custom-commands": "*"
    },
    "license": "MIT",
    "authors": [
        {
            "name": "SomeBody SomeOne",
            "email": "internet@is.ours.com"
        }
    ],
    "autoload": {
        "psr-4": {
            "My\\": "src/"
        }
    },
    "extra": {
        "custom-commands": {
            "commands": [
                "My\\Commands\\DummyCommand"
            ]
        }
    }
}

If you need that some script should be executed before every command (f.e. you need to define some constants), you can add there boot key with value that is filename relative from place where composer.json is., (*7)

In that case your composer.json should look similar to this:, (*8)

{
    "name": "my-project",
    "description": "",
    "type": "project",
    "require": {
        "imponeer/composer-custom-commands": "*"
    },
    "license": "MIT",
    "authors": [
        {
            "name": "SomeBody SomeOne",
            "email": "internet@is.ours.com"
        }
    ],
    "autoload": {
        "psr-4": {
            "My\\": "src/"
        }
    },
    "extra": {
        "custom-commands": {
            "commands": [
                "My\\Commands\\DummyCommand"
            ],
            "boot": "boot.php"
        }
    }
}

4. If you did everything correctly, you will be able to use new composer command that is embeded in your project.

How to contribute?

If you want to add some functionality or fix bugs, you can fork, change and create pull request. If you not sure how this works, try interactive GitHub tutorial., (*9)

If you found any bug or have some questions, use issues tab and write there your questions., (*10)

The Versions

05/07 2018

dev-master

9999999-dev

Adds possibility to define console commands as composer commands with Symfony console component syntax

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raimondas Rimkevičius

05/07 2018

dev-dependabot/composer/symfony/console-tw-4.1

dev-dependabot/composer/symfony/console-tw-4.1

Adds possibility to define console commands as composer commands with Symfony console component syntax

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raimondas Rimkevičius

22/03 2018

0.1

0.1.0.0

Adds possibility to define console commands as composer commands with Symfony console component syntax

  Sources   Download

MIT

The Requires

 

The Development Requires

by Raimondas Rimkevičius