forikal-uk / xmlauthor-example-command
Example command for managing xml files.
Installs: 13
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
pkg:composer/forikal-uk/xmlauthor-example-command
Requires
- php: >=7.1
 - symfony/console: ^3.4
 - symfony/filesystem: ^3.4
 - symfony/yaml: ^3.4
 - xmlsquad/xml-authoring-library: 0.3.3
 
Requires (Dev)
- phpunit/phpunit: ^7.1
 
This package is not auto-updated.
Last update: 2019-02-20 19:23:34 UTC
README
A git project that acts as an example of an xmlauthor command.
Prerequisites
- Git
 - PHP 
5.5.9+ - Composer installed globally
 
Install
- 
Install dependencies
composer install
 - 
Try
hello-worldcommand:bin/hello-world --configFilename=XmlAuthoringProjectSettings.yaml.dist
 
Building own command
- 
New commands should:
- 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/consoleproject. 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:
# 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() ); } } }
 
Test
vendor/bin/phpunit
TODO
[ ] Tests with virtual filesystem