2017 © Pedro Peláez
 

library xmlauthor-example-command

Example command for managing xml files.

image

xmlsquad/xmlauthor-example-command

Example command for managing xml files.

  • Monday, July 2, 2018
  • by forikal-uk
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 2 Dependents
  • 2 Suggesters
  • 0 Forks
  • 1 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

xmlauthor-example-command

A git project that acts as an example of an xmlauthor command., (*1)

Prerequisites

Install

  • Install dependencies, (*2)

    composer install
    
  • Try hello-world command:, (*3)

    bin/hello-world --configFilename=XmlAuthoringProjectSettings.yaml.dist
    

Building own command

  • New commands should:, (*4)

    • be written to run in a Symfony 3.4 console application. See Symfony's documentation on creating commands.have their own git repository project
    • have tests (one or more of PHPUnit/Behat/etc) stored within the project repository
    • be compatible with Symfony 3.4, and
    • make good use of the symfony/console project. i.e. $ composer require symfony/console:~3.4
    • adhere to the convention that allows the command to be automatically registered.
    • be installed by end users as a composer package
    • reuse existing libraries where possible. Such as;
    • use PSR-4 autoloading where possible.
    • be cross-platform compatible; Run on the command line on Windows 10, MacOS High Sierra and Linux.
    • provide README.md instructions on how to install and use the command from .
  • Example command:, (*5)

    # src/Command/NewCommand.php
    namespace XmlSquad\PackageName\Command;
    
    use XmlSquad\Library\Command\AbstractCommand;
    
    class NewCommand extends AbstractCommand
    {
        public function __construct()
        {
            # Specify command's name
            parent::__construct('new-command');
        }
    
        /**
         * {@inheritdoc}
         */
        protected function execute(InputInterface $input, OutputInterface $output)
        {
            try {
                $configFilename = $input->getOption('configFilename');
                $configOptions = $this->getConfigOptions($configFilename);
    
                dump($configOptions);
            } catch (FileNotFoundException $e) {
                $output->writeln(
                    $e->getMessage(), OutputInterface::VERBOSITY_NORMAL
                );
            }
        }
    }
    

Test

vendor/bin/phpunit

TODO

[ ] Tests with virtual filesystem, (*6)

The Versions

02/07 2018

dev-master

9999999-dev

Example command for managing xml files.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

24/06 2018

v0.2.2

0.2.2.0

Example command for managing xml files.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

24/06 2018

v0.2.1

0.2.1.0

Example command for managing xml files.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

01/06 2018

v0.2.0

0.2.0.0

Example command for managing xml files.

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires