Download the PHP package tg/tgwebvalid without Composer

On this page you can find all versions of the php package tg/tgwebvalid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package tgwebvalid

Library for Telegram Web App User Validation and Telegram Login Widget for PHP

Testing Status Minimum PHP Version Latest version License

Documentation

About TgWebValid

They say we are cool 😎

⭐️ Support us, give us a star on GitHub and become our sponsor 😊

🙏 Please let us know on GitHub if something isn't working for you or if you need additional functionality


User authentication occurs by encrypting the received, raw, user data and comparing it with the hash provided by the telegram. A failed check can be equated with a possible attempt to bypass or hack the system.

The library verifies users Telegram Login Widget and Telegram Web App

WARNING: Use user data only after successful authentication

To quickly and safely verify a user, we recommend following a few simple steps

Installation

You can install the TgWebValid library through the composer package manager by executing the command

Add the --no-dev flag to install only the dependencies needed to run your project in a production environment.

Using

The first thing you need to do is to set in the constructor of the TgWebValid class the token of the Telegram bot on behalf of which authentication is performed by default. And store the result in a variable.

Also, if you want to throw an exception in case of a validation error, set the second parameter to true. But be sure to use the try catch structure

If your project uses multiple bots, you can easily interact with them, just add them all

Getting a bot to work is easy. Specify the name of the bot to work with, or leave the argument empty to get the default bot

Next, you need to decide on the type of authentication you need to do.

Telegram Web App authentication

To perform this type of verification, you should use the validateInitData method. Which argument accepts data for processing. If the validation is successful, you will be returned an InitData object with the data, or false if the validation fails.

Use the second argument to enable or disable an exception on failed validation

Note. Certain data is present depending on the situation, so sometimes it can be null instead of data or a data object. More details in the Telegram official documentation

Telegram Login Widget authentication

To perform this type of check, you should use the validateLoginWidget method. Which argument accepts an array with raw user data. You will be returned a LoginWidget object with the data, or false if the validation fails

Use the second argument to enable or disable an exception on failed validation

Note. Certain data is present depending on the situation, so sometimes it can be null instead of data or a data object.

Full example

Additionally

Our library is autonomous, so it can be used in any frameworks, or without them.

Security

If you discover a security vulnerability in TgWebValid, please create an issue with a detailed description. All security vulnerabilities will be fixed immediately. Pull requests are also welcome.

Assistance

We will be glad if you join the development and improvement of the project. You can create an issue and/or a pull request

License

TgWebValid - is open source software available under the license file for more information.


All versions of tgwebvalid with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
nesbot/carbon Version ^2.67|^3.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package tg/tgwebvalid contains the following files

Loading the files please wait ....