PHP code example of xmlsquad / xmlauthor-example-command

1. Go to this page and download the library: Download xmlsquad/xmlauthor-example-command library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

xmlsquad / xmlauthor-example-command example snippets


    # 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
                );
            }
        }
    }