Skip to content

Commit

Permalink
Merge pull request #14 from CrazyTapok-bit/develop
Browse files Browse the repository at this point in the history
Added English language
  • Loading branch information
CrazyTapok-bit authored Jan 5, 2024
2 parents 2d9f7d6 + ef8e05a commit d6d336d
Show file tree
Hide file tree
Showing 29 changed files with 748 additions and 17 deletions.
6 changes: 3 additions & 3 deletions src/.vuepress/navbar/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export const enNavbar = navbar([
{
text: "Documentation",
icon: "book",
link: "/docs/README.md",
activeMatch: "^/docs/$"
link: "/en/docs/README.md",
activeMatch: "^/en/docs/$"
},
"/docs/example",
"/en/docs/example",
]);
2 changes: 1 addition & 1 deletion src/.vuepress/sidebar/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const enSidebar = sidebar({
{
text: "Documentation",
icon: "laptop-code",
prefix: "docs/",
prefix: "en/docs/",
children: "structure",
},
],
Expand Down
4 changes: 2 additions & 2 deletions src/docs/entity/init-data/chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ order: 3
- **Тип:** `string`
- **За замовчуванням:** `null`

*Опціонально.* Нік користувача чату
_Опціонально._ Нік користувача чату

### `photoUrl`

- **Тип:** `string`
- **За замовчуванням:** `null`

*Опціонально.* URL-адреса фотографії чату. Фотографія може бути у форматах `.jpeg` або `.svg`. Повертається лише для веб-програм, запущених із [меню вкладень](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu).
_*_Опціонально._ URL-адреса фотографії чату. Фотографія може бути у форматах `.jpeg` або `.svg`. Повертається лише для веб-програм, запущених із [меню вкладень](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu).

## Методи {#methods}

Expand Down
4 changes: 2 additions & 2 deletions src/docs/entity/init-data/receiver.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ order: 2

- **Тип:** `int`

Унікальний ідентифікатор для цього чату. Це число може мати 32-52 значущих біти. Тому 64-розрядне ціле число зі знаком або тип з плаваючою точністю подвійної точності безпечні для зберігання цього ідентифікатора.
Унікальний ідентифікатор користувача або бота. Це число може мати 32-52 значущих біти. Тому 64-розрядне ціле число зі знаком або тип з плаваючою точністю подвійної точності безпечні для зберігання цього ідентифікатора.

### `isBot`

Expand Down Expand Up @@ -50,7 +50,7 @@ _Опціонально._ `true`, якщо цей користувач бот.
- **Тип:** `string`
- **За замовчуванням:** `null`

_Опціонально._ URL-адреса фотографії чату. Фотографія може бути у форматах `.jpeg` або `.svg`. Повертається лише для веб-програм, запущених із [меню вкладень](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu).
_Опціонально._ URL-адреса фотографії профілю користувача. Фотографія може бути у форматах `.jpeg` або `.svg`. Повертається лише для веб-програм, запущених із [меню вкладень](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu).

## Методи {#methods}

Expand Down
4 changes: 2 additions & 2 deletions src/docs/entity/init-data/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ order: 1

- **Тип:** `int`

Унікальний ідентифікатор для цього чату. Це число може мати 32-52 значущих біти. Тому 64-розрядне ціле число зі знаком або тип з плаваючою точністю подвійної точності безпечні для зберігання цього ідентифікатора.
Унікальний ідентифікатор користувача або бота. Це число може мати 32-52 значущих біти. Тому 64-розрядне ціле число зі знаком або тип з плаваючою точністю подвійної точності безпечні для зберігання цього ідентифікатора.

### `isBot`

Expand Down Expand Up @@ -74,7 +74,7 @@ _Опціонально._ `true`, якщо цей користувач дода
- **Тип:** `string`
- **За замовчуванням:** `null`

_Опціонально._ URL-адреса фотографії чату. Фотографія може бути у форматах `.jpeg` або `.svg`. Повертається лише для веб-програм, запущених із [меню вкладень](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu).
_Опціонально._ URL-адреса фотографії профілю користувача. Фотографія може бути у форматах `.jpeg` або `.svg`. Повертається лише для веб-програм, запущених із [меню вкладень](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu).

## Методи {#methods}

Expand Down
2 changes: 1 addition & 1 deletion src/docs/example.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ try {
throw: true
);

/** Налаштую ще один додатковий бот щоб працюват з ними */
/** Налаштую ще один додатковий бот щоб працювати з ними */
$tgWebValid->addBot(new BotConfig(
name: 'secondary',
token: 'TELEGRAM_BOT_TOKEN_2'
Expand Down
3 changes: 1 addition & 2 deletions src/docs/exception/bot.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ icon: circle-chevron-right
order: 1
---

Якщо ви отримуєте цей виняток, це може свідчити про те що назва бота, який ви намагаєтесь [застосувати](../get-started/usage.md), невірна, або такого бота не існує у списку доданих.

Якщо ви отримуєте цей виняток, це може свідчити про те що назва бота, який ви намагаєтесь [застосувати](../get-started/usage.md), невірна, або такого бота не існує у списку доданих.
2 changes: 1 addition & 1 deletion src/docs/get-started/multiple.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use TgWebValid\BotConfig;

/**
* Спочатку налаштуйте базову конфігурацію
* Після цього, додате необхідну кількість ботів
* Після цього, додайте необхідну кількість ботів
*/

$tgWebValid->addBot(new BotConfig(
Expand Down
2 changes: 1 addition & 1 deletion src/docs/get-started/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ $bot = $tgWebValid->bot(
## Валідатори {#validators}
Далі потрібно визначитися з типом аутентифікації, який потрібно зробити.

Зі списком доступних валідаторів можна ознайовитись на [цій сторінці](../validator/)
Зі списком доступних валідаторів можна ознайомитись на [цій сторінці](../validator/)
4 changes: 2 additions & 2 deletions src/en/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ tagline: An easy way to check Telegram Login Widget and Telegram Mini App users
actions:
- text: Get Started
icon: signs-post
link: /docs/
link: /en/docs/
type: primary

- text: Example
link: /docs/example/
link: /en/docs/example/

footer: false
36 changes: 36 additions & 0 deletions src/en/docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Documentation
index: false
icon: book
---

[![Testing Status](https://github.com/CrazyTapok-bit/tgWebValid/workflows/PHP%20CI/badge.svg)](https://github.com/CrazyTapok-bit/tgWebValid/actions)
[![Minimum PHP Version](https://img.shields.io/packagist/dependency-v/tg/tgwebvalid/php)](https://packagist.org/packages/tg/tgwebvalid)
[![Latest version](https://img.shields.io/packagist/v/tg/tgWebValid)](https://packagist.org/packages/tg/tgwebvalid)
[![Total Downloads](https://img.shields.io/packagist/dt/tg/tgwebvalid)](https://packagist.org/packages/tg/tgwebvalid)
[![Total Stars](https://img.shields.io/packagist/stars/tg/tgwebvalid)](https://packagist.org/packages/tg/tgwebvalid)
[![License](https://img.shields.io/packagist/l/tg/tgwebvalid)](https://packagist.org/packages/tg/tgwebvalid)

[![StandWithUkraine](https://raw.githubusercontent.com/CrazyTapok-bit/tgWebValid/4.x/badges/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)
[![StandWithUkraine](https://raw.githubusercontent.com/CrazyTapok-bit/tgWebValid/4.x/badges/RussianWarship.svg)](https://stand-with-ukraine.pp.ua)

[![StandWithUkraine](https://raw.githubusercontent.com/CrazyTapok-bit/tgWebValid/4.x/StandWithUkraine.svg)](https://stand-with-ukraine.pp.ua)

## About TgWebValid {#about}

Our library is light, fast :rocket:, modern and has `100%` autocomplete for getting user data. At the same time, we made it autonomous, so its use is possible in any frameworks or without them.

And most importantly, our library is designed to verify users of [Telegram Mini App](https://core.telegram.org/bots/webapps) and [Telegram Login Widget](https://core.telegram.org/widgets/login) on PHP

Authentication occurs by encrypting the received raw user data and comparing it with a hash provided by Telegram.

:::info Recommendation
Provide access to sensitive user data **only after successful authentication**
:::

**Start verifying users quickly and securely.**

:::tip Pay attention
The average time to deploy the TgWebValid library in your project is **only ~ 1 min**.
:::

9 changes: 9 additions & 0 deletions src/en/docs/entity/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Entities
icon: database
index: false
dir:
order: 3
---

<AutoCatalog />
86 changes: 86 additions & 0 deletions src/en/docs/entity/init-data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
---
title: InitData
icon: object-group
dir:
order: 1
---

This object contains the data that is passed to the applet when it is opened. This entity can only be accessed after successful user authentication using the validator [mini-app](../../validator/web-app.md).

## Properties {#properties}

### `queryId`

- **Type:** `string`
- **Default:** `null`

__Optional._ A unique identifier for the Web App session

### `user`

- **Type:** [`TgWebValid\Entities\InitData\User`](./user.md)
- **Default:** `null`

__Optional._ An object containing data about the current user.

### `receiver`

- **Type:** [`TgWebValid\Entities\InitData\Receiver`](./receiver.md)
- **Default:** `null`

__Optional._ An object containing data about the chat partner of the current user in the chat where the bot was launched via the attachment menu. Returned only for private chats and only for Web Apps launched via the [attachment menu](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu).

### `chat`

- **Type:** [`TgWebValid\Entities\InitData\Chat`](./chat.md)
- **Default:** `null`

__Optional._ An object containing data about the chat where the bot was launched via the attachment menu. Returned for supergroups, channels and group chats – only for Web Apps launched via the [attachment menu](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu).

### `chatType`

- **Type:** `string`
- **Default:** `null`

__Optional._ Type of the chat from which the Web App was opened. Can be either `sender` for a private chat with the user opening the link, `private`, `group`, `supergroup`, or `channel`. Returned only for Web Apps launched from direct links.

### `chatInstance`

- **Type:** `string`
- **Default:** `null`

__Optional._ Global identifier, uniquely corresponding to the chat from which the Web App was opened. Returned only for Web Apps launched from a direct link.

### `startParam`

- **Type:** `string`
- **Default:** `null`

The value of the [`startattach`](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu) parameter, passed via link. Only returned for Web Apps when launched from the [attachment menu](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu) via link.

### `canSendAfter`

- **Type:** `int`
- **Default:** `null`

__Optional._ Time in seconds, after which a message can be sent via the [answerWebAppQuery](https://core.telegram.org/bots/api#answerwebappquery) method.

### `authDate`

- **Type:** [`CarbonInterface`](https://carbon.nesbot.com/docs/)

A date interface for obtaining the time of opening a form in `Unix` format, and not only that.

### `hash`

- **Type:** `string`

A hash of all passed parameters, with which the validator can check their validity.

## Methods {#methods}

### `toArray`

Returns the entity, including children (if any), as an array.

[Created on the basis of official documentation](https://core.telegram.org/bots/webapps#webappinitdata)
49 changes: 49 additions & 0 deletions src/en/docs/entity/init-data/chat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: Chat
icon: message
order: 3
---

This object represents a chat.

## Properties {#properties}

### `id`

- **Type:** `int`

A unique identifier for this chat. This number can have 32-52 significant bits. Therefore, a 64-bit signed integer or double-precision float type is safe to store this identifier.

### `type`

- **Type:** `string`

Type of chat, can be either `group`, `supergroup` or `channel`

### `title`

- **Type:** `string`

Title of the chat

### `username`

- **Type:** `string`
- **Default:** `null`

__Optional._ Username of the chat

### `photoUrl`

- **Type:** `string`
- **За замовчуванням:** `null`

__Optional._ URL of the chat’s photo. The photo can be in `.jpeg` or `.svg` formats. Only returned for Web Apps launched from the [attachment menu](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu).

## Methods {#methods}

### `toArray`

Returns the entity, including children (if any), as an array.

[Created on the basis of official documentation](https://core.telegram.org/bots/webapps#webappchat)
61 changes: 61 additions & 0 deletions src/en/docs/entity/init-data/receiver.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: Receiver
icon: paper-plane
order: 2
---

This object contains the user data of the Mini App.

## Properties {#properties}

### `id`

- **Type:** `int`

The unique identifier of the user or bot. This number can have 32-52 significant bits. Therefore, a 64-bit signed integer or double-precision floating-point type is safe to store this identifier.

### `isBot`

- **Type:** `bool`
- **Default:** `null`

__Optional._ `true`, if this user is a bot.

### `firstName`

- **Type:** `string`

First name of the bot.

### `lastName`

- **Type:** `string`
- **Default:** `null`
- __Optional._ Last name of the bot.

### `username`

- **Type:** `string`
- **Default:** `null`
- __Optional._ Username of the bot.

### `isPremium`

- **Type:** `bool`
- **Default:** `null`
- __Optional._ `true`, if this user is a Telegram Premium user

### `photoUrl`

- **Type:** `string`
- **Default:** `null`

__Optional._ URL of the user’s profile photo. The photo can be in `.jpeg` or `.svg` formats. Only returned for web applications launched from [attachment menu](https://core.telegram.org/bots/webapps#adding-bots-to-the-attachment-menu).

## Methods {#methods}

### `toArray`

Returns the entity, including children (if any), as an array.

[Created on the basis of official documentation](https://core.telegram.org/bots/webapps#webappuser)
Loading

0 comments on commit d6d336d

Please sign in to comment.