Hello!
I use some external API, like twilio and others. I wonder what is the best practices where should I put the logic. For example, usually I'm able to find some package which does the work for me, but sometimes I need to write it by myself. What I do: I create an app/service folder where I put some classes, like, Twilio.php. In the constructor I initialize tokens/authentication. An example is: http://laravel.io/bin/NkbvG#12
I wonder if it's okay or should I consider refactoring? I haven't ever created any packages and I want to use the API only in this project, so that's what I have so far.
Another much more important thing is where to put this logic: I need to send notifications for users. In order to do that I use cron, since I need to check DB state every minute. So, in Laravel 5 we have scheduler. When I've tried to use repositories directly in scheduler they didn't get injected. Anyway, I wouldn't put all my notifications in the single scheduler method, so I've taken an example from documentation and made an artisan command. But I'm not sure if it's a right place to make many artisan commands for each cron command, how do you think?
Thanks in advance!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community