Skip to content

Commit

Permalink
add composer installation
Browse files Browse the repository at this point in the history
  • Loading branch information
OxMohsen committed Aug 22, 2022
1 parent e5f0054 commit eff8197
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,31 +78,35 @@ These instructions will get you a copy of the project and show you how to use it
You'll need [Git](https://git-scm.com) and [composer](https://getcomposer.org/download/)

### Installation

1. Clone the repo
```sh
git clone https://github.com/OxMohsen/validating-data.git
```
2. move to the directory
```sh
cd validating-data
```
3. Install composer packages
1. using composer
```sh
composer install
composer require oxmohsen/validating-data
```

2. install manually
- Clone the repo
```sh
git clone https://github.com/OxMohsen/validating-data.git
```
- move to the directory
```sh
cd validating-data
```
- Install composer packages
```sh
composer install
```

### Usage
1. Enter your Bot Token in `Config.php`
```php
public const BOT_TOKEN = 'YOUR_BOT_TOKEN';
```
2. load the project and use the Validate class to validate data
1. load the project
```php
require_once __DIR__ . '/vendor/autoload.php';
use OxMohsen\TgBot\Validate;
```
2. use the Validate class to validate initData
```php
<?php
require_once 'vendor/autoload.php';
use OxMohsen\TgBot\Validate;
if (Validate::isSafe($initData)) {
if (Validate::isSafe($bot_token, $initData)) {
echo 'valid data';
} else {
echo 'invalid data';
Expand Down

0 comments on commit eff8197

Please sign in to comment.