PHPackages                             scriptoshi/livewire-telegram-auth - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. scriptoshi/livewire-telegram-auth

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

scriptoshi/livewire-telegram-auth
=================================

Laravel Livewire component for Telegram login authentication

1.0.4(1y ago)245MITPHPPHP ^8.2

Since Mar 14Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/scriptoshi/livewire-telegram-auth)[ Packagist](https://packagist.org/packages/scriptoshi/livewire-telegram-auth)[ RSS](/packages/scriptoshi-livewire-telegram-auth/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

Livewire Telegram Auth
======================

[](#livewire-telegram-auth)

A Laravel 12 and Livewire package that provides an easy way to authenticate users via Telegram.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 12.x
- Livewire 3.0+
- TgWebValid 4.2+

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require scriptoshi/livewire-telegram-auth
```

Configuration
-------------

[](#configuration)

### 1. Add Telegram Bot Token to your .env file

[](#1-add-telegram-bot-token-to-your-env-file)

```
TELEGRAM_BOT_TOKEN=123456789:ABCDEFGHIJKLMNOPQRSTUVWXYZ

```

Note: Use the full token including the bot ID (numbers before the colon) and the token part (after the colon). The component will automatically extract the bot ID for authentication.

### 2. Add Telegram Bot configuration to your config/services.php

[](#2-add-telegram-bot-configuration-to-your-configservicesphp)

```
'telegram' => [
    'telegramBotToken' => env('TELEGRAM_BOT_TOKEN'),
    'profile_photo_disk' => 'public', // Storage disk for profile photos
],
```

### 3. Database Schema

[](#3-database-schema)

This package adds three fields to your users table:

- `telegramId` - The Telegram user identifier
- `telegram_avatar_url` - URL to the user's Telegram avatar image
- `telegram_photo_path` - Local path to the user's profile photo

The good news is that you don't need to modify your User model's `$fillable` array. The package sets these fields directly on the model instance.

### 4. Publish and run migrations

[](#4-publish-and-run-migrations)

```
php artisan vendor:publish --tag=telegram-auth-migrations
php artisan migrate
```

Migrations will make the password and Email Field `nullable` and these field will be nulled for users who authenticate via telegram. so beware if you typehint or expect these to be a string.

### 5. Configure Tailwind CSS

[](#5-configure-tailwind-css)

To ensure that Tailwind CSS properly processes the component styles, add this package to your content sources in your CSS file (typically `resources/css/app.css`):

```
/* Add this line with your other @source directives */
@source '../../vendor/scriptoshi/livewire-telegram-auth/resources/views/**/*.blade.php';
```

For example, your CSS file might look similar to this:

```
@import "tailwindcss";

@source "../views";
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../vendor/scriptoshi/livewire-telegram-auth/resources/views/**/*.blade.php';

/* Rest of your CSS file */
```

### 6. (Optional) Publish views

[](#6-optional-publish-views)

```
php artisan vendor:publish --tag=telegram-auth-views
```

Usage
-----

[](#usage)

Simply include the Livewire component in your login page:

```

```

Customization
-------------

[](#customization)

### User Registration Logic

[](#user-registration-logic)

If you need to customize the user registration process, you can extend the `TelegramLogin` component and override the `register` method:

```
