-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
executable file
·32 lines (23 loc) · 784 Bytes
/
index.php
File metadata and controls
executable file
·32 lines (23 loc) · 784 Bytes
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
<?php
declare(strict_types=1);
/*
* Used as Api entry point
* On send request accept messages and store them to MongoDb
* On status request get message status from MongoDb
*/
use Api\Sms\Api\Exception\ApplicationException;
use Api\Sms\Api\Http\Factory\RequestFactory;
use Api\Sms\Api\Http\Factory\ResponseFactory;
use Api\Sms\AppKernel;
use Api\Sms\ErrorHandler;
require_once(__DIR__ . '/vendor/autoload.php');
$config = require_once(__DIR__ . '/config/config.php');
$kernel = new AppKernel;
try {
$request = (new RequestFactory())->createFromGlobals();
$kernel->boot($config);
$response = $kernel->handle($request);
} catch (ApplicationException $e) {
$response = (new ErrorHandler(new ResponseFactory()))->getResponseFromError($e);
}
$response->send();