iIlluminate/mail not available in artisan

Viewed 158

I use Lumen7 (based on Laravel7) as framework for my projekt. I tried to install the mailer, but it doesn't work.

I did the following steps:

  1. Installed illuminate/mail via composer require illuminate/mail:7
  2. Added the following to bootstrap/app.php
     $app->register(Illuminate\Mail\MailServiceProvider::class);
     $app->configure('mail');
    
     $app->alias('mail.manager', Illuminate\Mail\MailManager::class);
     $app->alias('mail.manager', Illuminate\Contracts\Mail\Factory::class);
     
     $app->alias('mailer', Illuminate\Mail\Mailer::class);
     $app->alias('mailer', Illuminate\Contracts\Mail\Mailer::class);
     $app->alias('mailer', Illuminate\Contracts\Mail\MailQueue::class);
  1. Copied the mail.php from https://github.com/laravel/laravel/blob/master/config/mail.php to config/mail.php

  2. Added the following to my .env

MAIL_MAILER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=
MAIL_PASSWORD=
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=hello@example.com
MAIL_FROM_NAME="Example app"

When I try to generate my mailable via php artisan make:mail MyMailable, then I get the following error: Command "make:mail" is not defined.

When I use php artisan, then I don't see mail in the command list of make, just the following make commands:

 make
  make:migration      Create a new migration file
  make:seeder         Create a new seeder class

I have no idea what the issue is, hopefully someone can help me.

1 Answers

I think I've found a way to achieve this. Apparently Lumen needs another package installed to have all the Laravel methods. Simply add the composer package:

composer require flipbox/lumen-generator

And enable it in your bootstrap/app.php file:

$app->register(Flipbox\LumenGenerator\LumenGeneratorServiceProvider::class);

Afterwards your "php artisan" should return way more methods, also for "make:mail".

Related