use Symfony\Component\Console\Input\InputInterface; $input = new InputInterface(); $arg = $input->getFirstArgument(); if ($arg != null) { echo "The first argument is: " . $arg; } else { echo "No arguments passed."; }
use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Exception\RuntimeException; $input = new InputInterface(); $arg = $input->getFirstArgument(); if ($arg != null) { echo "The first argument is: " . $arg; } else { throw new RuntimeException('No arguments passed.'); }The Symfony\Component\Console package library is used in these examples.