Laravel Totem is a new Laravel package that allows you to easily manage your Laravel Schedules. This package has a beautiful UI that allows you to create, edit, or delete your scheduled commands!
Just take a look at a quick screenshot of this admin interface:
This package was inspired by Horizon, and it is very easy to use. First off. Let's see how easy this package is to install with the new Laravel 5.5 Auto-discovery. First we'll create a new Laravel app:
laravel new totem
Next, we'll need to create a database for our application and add it to our the .env
file of our newly created laravel app.
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=totem
DB_USERNAME=root
DB_PASSWORD=
Now, we'll need to make sure we CD into that directory and include the package:
cd totem
composer require studio/laravel-totem
Finally, we need to run our migrations and publish the totem assets:
php artisan migrate
php artisan totem:assets
And that's it. We can now visit our new project in the web browser and visit the /totem
route. In my case I can visit: http://totem.dev/totem
And we'll see the following screen in front of us:
We can now click on 'New Task' and create our first task.
Try out adding a new task with any name and any command. You can then set a frequency such as every minute, every 5 minutes, and many other frequencies. Scroll down to the box that says Email Notification and enter in your email and then click 'Save'. You will now see this schedule on your list of tasks:
Now, before we test this out we'll need to make sure that we add our Email Notification settings for our app.
If you do not add your email settings and you try and execute the command it will fail because it will not be able to send out the email notification.
An easy way to test emails is to sign up for a free account at http://mailtrap.io and then add in your mailtrap credentials in your .env file:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=YourMailTrapUser
MAIL_PASSWORD=YourMailTrapPassword
MAIL_ENCRYPTION=null
Now, go ahead and hit the execute button on the right of the task and the command will execute and send you an email notification. You should now be able to visit your Mailtrap dashboard and you will see your new notification:
So, when you need a UI to show you all your scheduled tasks you'll have to checkout this awesome package. It is still in active development so perhaps you may even want to contribute to this awesome project https://github.com/codestudiohq/laravel-totem
Comments (0)