I'm trying to get the base url on a command to get localhost on local and the production url on producction but all the exmaples I found are using the reuqest object but I don't have it on a command:
class PasswordExpirationCommand extends Command
{
private $ms;
private $translator;
private $em;
public function __construct(MailService $ms, TranslatorInterface $translator, EntityManagerInterface $em)
{
parent::__construct();
$this->ms = $ms;
$this->translator = $translator;
$this->em = $em;
}
protected function configure()
{
$this
->setName('app:password:expiration')
->setDescription('Expire 3 months old password');
}
/**
*
*
*
* @param InputInterface $input
* @param OutputInterface $output
* @return int|void|null
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$base_url =....//need http://localhost/ or https://production_url
//reminders
$this->passwordExpirationReminder();
}