Heroku recently found itself in hot water for one clear reason: it was switching from offering free hosting for small projects to just offering premium plans. For their tiny initiatives, the majority of developers had to hunt for an alternative location.
The news broke just as I was about to mount Larawiz, my online Laravel scaffolder, and start thinking about Heroku. Some Laravel projects may be in danger as a result of this, but fortunately, there are always alternatives that are not controlled by SalesForce and that can still function with some restrictions as long as you don’t seek excessive power.
After hearing this news, I made the decision to search the Internet for other hosting companies that offered decent free plans. Consider the word “fair” as a place to place your project without worrying that your credit card would be hit with an erroneous five figure bill.
This is my list, in no particular order.
Before we get started, if you’re intending to build a new Laravel application and you don’t want to spend hours generating models or migrations, you might want to check out Larawiz.
We’ll discover how to use Laravel 9 to send Telegram
Step:1 Install the Telegram notification channel first.
You must install the Telegram notification channel using Composer before you may deliver notifications using Telegram.
composer require laravel-notification-channels/telegram
Step:2 Create your Telegram bot in step two.
Open Telegram and say hi to the BotFather bot there.
Choose or enter /newbot. Select a username and a name to receive your token.
Step:3 In the config/service.php section, add the Telegram
# config/services.php
‘telegram-bot-api’ => [
‘token’ => env(‘TELEGRAM_BOT_TOKEN’, ‘YOUR BOT TOKEN HERE’)
],
Fill up the environment file with your
# .env
TELEGRAM_BOT_TOKEN=5388040587:AAH0Jm7h9Meycg-M9Zh7MT8AeQMvI-7VsdQ
Step:4 Get your groupId after
choose a new group
Put your bot in the group.
Choose a group name.
Group IDBot with this.
Gather your team. Id
Step: 5 Make and set up a notification
Each notification in Laravel is represented by a single class, which is normally kept in the directory app/Notifications. If you run the make command, a directory will be created for you even if you don’t see it in your application. notification artisan’s order:
php artisan make:notification SendNotification
following configure file app/Notification/SendNotification
<?php
namespace App\Notifications;use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
use NotificationChannels\Telegram\TelegramMessage;class SendNotification extends Notification
{
use Queueable; public function __construct()
{
//
}
public function via($notifiable)
{
return ['telegram'];
}public function toTelegram($notifiable)
{
return TelegramMessage::create()
->to('-794197572')
->content('Enviando nuestro primer mensaje con Telegram');
}}
Step:6 Send Message
You can deliver notifications using the notify trait or, as an alternative, the Notification façade. When you need to notify numerous notifiable entities, such as a group of users, this strategy can be helpful.
notify trait
use App\Notifications\SendNotification;$user->notify(new SendNotification($invoice));
Notification facade
use Illuminate\Support\Facades\Notification;Notification::send($users, new SendNotification($invoice));