-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathindex.php
75 lines (65 loc) · 2.07 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
/*
|--------------------------------------------------------------------------
| Including Kernel Class
|--------------------------------------------------------------------------
|
| Import the Kernel class from the App namespace to use it in this script.
|
*/
use App\Kernel;
/*
|--------------------------------------------------------------------------
| Autoloading Dependencies
|--------------------------------------------------------------------------
|
| Require the Composer autoload file to autoload all dependencies.
|
*/
require_once 'vendor/autoload.php';
/*
|--------------------------------------------------------------------------
| Loading Environment Variables
|--------------------------------------------------------------------------
|
| Create an immutable dotenv instance to load environment variables from
| the .env file in the current directory.
|
*/
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
// Display errors if the application is in development mode.
if (env("APP_ENV") === "development") {
// Set PHP to display errors.
ini_set("display_errors", "on");
// Report all errors.
error_reporting(E_ALL);
}
/*
|--------------------------------------------------------------------------
| Defining API URL
|--------------------------------------------------------------------------
|
| Define a constant API_URL by concatenating it with the token retrieved
| from the environment variables.
|
*/
define('API_URL', 'https://api.telegram.org/bot' . env('TOKEN') . '/');
/*
|--------------------------------------------------------------------------
| Retrieving Raw Input Data
|--------------------------------------------------------------------------
|
| Get the raw POST data from the input stream.
|
*/
$content = file_get_contents("php://input");
/*
|--------------------------------------------------------------------------
| Instantiating Kernel Class
|--------------------------------------------------------------------------
|
| Instantiate the Kernel class, passing in the raw input data.
|
*/
$Kernel = new Kernel($content);