akxz / laravel-telegram-auth
Laravel Telegram Login Auth
dev-master
2020-09-29 06:56 UTC
Requires
- php: >=7.2
- illuminate/http: ~5.6|~5.7|~5.8|^6.0|^7.0|^8.0
- illuminate/support: ~5.6|~5.7|~5.8|^6.0|^7.0|^8.0
- nesbot/carbon: ^1.32|^2.32
This package is not auto-updated.
Last update: 2025-07-03 05:52:13 UTC
README
This package is a Laravel 5-8 service provider which provides support for Laravel Login and is very easy to integrate with any project that requires Telegram authentication.
Installation
Require this package with composer.
composer require akxz/laravel-telegram-login-auth
Laravel >=5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
Copy the package config to your local config with the publish command:
php artisan vendor:publish --provider="Akxz\LaravelTelegramLoginAuth\TelegramLoginServiceProvider"
Usage example
Setup information Telegram Login Widget
In routes/web.php
:
for Laravel 5-7:
Route::get('auth/telegram/callback', 'AuthController@handleTelegramCallback')->name('auth.telegram.handle');
for Laravel 8:
use App\Http\Controllers\AuthController; Route::get('auth/telegram/callback', [AuthController::class, 'handleTelegramCallback']);
In AuthController
:
namespace App\Http\Controllers; use Akxz\LaravelTelegramLoginAuth\TelegramLoginAuth; class AuthController extends Controller { /** * @var TelegramLoginAuth */ protected $telegram; /** * AuthController constructor. * * @param TelegramLoginAuth $telegram */ public function __construct(TelegramLoginAuth $telegram) { $this->telegram = $telegram; } /** * Get user info and log in (hypothetically) * * @return \Illuminate\Routing\Redirector|\Illuminate\Http\RedirectResponse */ public function handleTelegramCallback() { if ($this->telegram->validate()) { $user = $this->telegram->user(); // } return redirect('/'); } }