public function handleWebRequest()
{
/** @var HttpRequestInterface $request */
$request = $this->getComponent(HttpRequestInterface::class);
/** @var RouterInterface $router */
$router = $this->getComponent(RouterInterface::class);
$url = $request->getUrl();
$method = $request->getMethod();
$this->logDebug("Matching route for url '{$url}' and method '{$method}'");
$matches = $router->match($url, $method);
foreach ($matches as $match) {
$matched = $this->handleMatch($match, $router);
if ($matched !== false) {
return true;
}
}
$this->logDebug("Matching route not found");
throw new NotFoundHttpException("Page not found");
}
public function handleMatch(array $match, RouterInterface $router = null)
{
if (is_array($match['target']) &&
isset($match['target'][0]) &&
is_a($match['target'][0], ControllerInterface::class, true))
{
$controllerClass = $match['target'][0];
$action = isset($match['target'][1]) ? $match['target'][1] : null;
$params = isset($match['params']) ? $match['params'] : [];
$name = isset($match['name']) ? $match['name'] : null;
if ($router && $name) {
$router->setCurrentName($name);
}
$this->logDebug("Processing route to controller '{$controllerClass}' and action '{$action}'", ['params' => $params]);
/** @var Controller $controller */
$controller = $this->_container->construct($controllerClass);
$this->logDebug("Application run");
$this->eventTrigger("application.beforeRun", [], $this);
$this->provideModuleEvent('onApplicationRun');
register_shutdown_function([$this, 'end'], 0);
$this->logDebug("Start handling request");
$this->handleRequest();
$this->end();
}
public function end($status = 0, $response = null)
{
$this->eventTrigger("application.beforeEnd", [], $this);
$this->provideModuleEvent('onApplicationEnd', [$status, $response]);
exit($status);
}
public function handleRequest()
{
if ($this->getIsWebMode()) {
$this->handleWebRequest();
} else {
$this->handleCliRequest();
}
}
/**
* @return bool
*/
public static function getIsCliMode()
{
return php_sapi_name() == 'cli';
}
/**
* @return bool
*/
public static function getIsWebMode()
{
return !self::getIsCliMode();
}
/**
* Check or create system path
*
* @param $path
* @return bool
*/
protected function setUpPath($path): bool
{
return is_dir($path) || mkdir($path, 0755, true);
}
public function run()
{
$this->logDebug("Application run");
$this->eventTrigger("application.beforeRun", [], $this);
$this->provideModuleEvent('onApplicationRun');
register_shutdown_function([$this, 'end'], 0);
$this->logDebug("Start handling request");
$this->handleRequest();
$this->end();
}
public function end($status = 0, $response = null)
{
$this->eventTrigger("application.beforeEnd", [], $this);
$this->provideModuleEvent('onApplicationEnd', [$status, $response]);
exit($status);
}
public function handleRequest()
{
if ($this->getIsWebMode()) {
$this->handleWebRequest();
} else {
$this->handleCliRequest();
}
}
/**
<?php
include(__DIR__ . '/../vendor/autoload.php');
$configPath = __DIR__ . '/../app/config/settings.php';
$dotenv = Dotenv\Dotenv::create(__DIR__ . '/../');
$dotenv->load();
define('PHACT_DEBUG', getenv('DEBUG') === 'true');
$config = include $configPath;
\Phact\Main\Phact::init($config);
\Phact\Main\Phact::app()->run();
Key | Value |
PHPRC | /var/www/u0649442/data/php-bin-php74 |
PHP_INI_SCAN_DIR | /var/www/u0649442/data/php-bin-php74/instaopener.ru: |
PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin |
PWD | /var/www/php-bin-php74/u0649442/instaopener.ru |
SHLVL | 0 |
SCRIPT_NAME | /index.php |
REQUEST_URI | /bot/storis-dobroe-utro |
QUERY_STRING | |
REQUEST_METHOD | GET |
SERVER_PROTOCOL | HTTP/1.0 |
GATEWAY_INTERFACE | CGI/1.1 |
REDIRECT_URL | /bot/storis-dobroe-utro |
REMOTE_PORT | 33000 |
SCRIPT_FILENAME | /var/www/u0649442/data/www/instaopener.ru/www/index.php |
SERVER_ADMIN | alexsandrskopin@gmail.com |
CONTEXT_DOCUMENT_ROOT | /var/www/u0649442/data/www/instaopener.ru/www |
CONTEXT_PREFIX | |
DOCUMENT_ROOT | /var/www/u0649442/data/www/instaopener.ru/www |
REMOTE_ADDR | 3.235.140.73 |
SERVER_PORT | 443 |
SERVER_ADDR | 127.0.0.1 |
SERVER_NAME | instaopener.ru |
SERVER_SOFTWARE | Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 Phusion_Passenger/5.3.7 |
SERVER_SIGNATURE | |
HTTP_USER_AGENT | claudebot |
HTTP_ACCEPT | */* |
HTTP_CONNECTION | close |
HTTP_X_FORWARDED_PORT | 443 |
HTTP_X_FORWARDED_PROTO | https |
HTTP_HOST | instaopener.ru |
PERL5LIB | /usr/share/awstats/lib:/usr/share/awstats/plugins |
REQUEST_SCHEME | https |
HTTPS | on |
UNIQUE_ID | ZgblKfRNJpJoj5AHgVqLDAAAAFA |
REDIRECT_STATUS | 200 |
REDIRECT_PERL5LIB | /usr/share/awstats/lib:/usr/share/awstats/plugins |
REDIRECT_REQUEST_SCHEME | https |
REDIRECT_HTTPS | on |
REDIRECT_UNIQUE_ID | ZgblKfRNJpJoj5AHgVqLDAAAAFA |
FCGI_ROLE | RESPONDER |
PHP_SELF | /index.php |
REQUEST_TIME_FLOAT | 1711727913.3608 |
REQUEST_TIME | 1711727913 |
argv | Array ( ) |
argc | 0 |
DEBUG | true |
LOCAL | false |
DB_HOST | 127.0.0.1 |
DB_NAME | u0649442_default |
DB_USER | u0649442_default |
DB_PASS | 8WEBR!Vg |
HOST_INFO | http://example.com |
API_BOT | 653503651:AAG9MZOQvHHoQrPczjFoBt4crCLVOmxZu1Y |
BOT_NAME | instaOpener_bot |
BASE_URL_TELEGRAM | https://t.me/ |
DOMAIN | instaopener.ru |
SENTRY_DSN |
Key | Value |
PHPRC | /var/www/u0649442/data/php-bin-php74 |
PHP_INI_SCAN_DIR | /var/www/u0649442/data/php-bin-php74/instaopener.ru: |
PATH | /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin |
PWD | /var/www/php-bin-php74/u0649442/instaopener.ru |
SHLVL | 0 |
SCRIPT_NAME | /index.php |
REQUEST_URI | /bot/storis-dobroe-utro |
QUERY_STRING | |
REQUEST_METHOD | GET |
SERVER_PROTOCOL | HTTP/1.0 |
GATEWAY_INTERFACE | CGI/1.1 |
REDIRECT_URL | /bot/storis-dobroe-utro |
REMOTE_PORT | 33000 |
SCRIPT_FILENAME | /var/www/u0649442/data/www/instaopener.ru/www/index.php |
SERVER_ADMIN | alexsandrskopin@gmail.com |
CONTEXT_DOCUMENT_ROOT | /var/www/u0649442/data/www/instaopener.ru/www |
CONTEXT_PREFIX | |
DOCUMENT_ROOT | /var/www/u0649442/data/www/instaopener.ru/www |
REMOTE_ADDR | 3.235.140.73 |
SERVER_PORT | 443 |
SERVER_ADDR | 127.0.0.1 |
SERVER_NAME | instaopener.ru |
SERVER_SOFTWARE | Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips mod_fcgid/2.3.9 Phusion_Passenger/5.3.7 |
SERVER_SIGNATURE | |
HTTP_USER_AGENT | claudebot |
HTTP_ACCEPT | */* |
HTTP_CONNECTION | close |
HTTP_X_FORWARDED_PORT | 443 |
HTTP_X_FORWARDED_PROTO | https |
HTTP_HOST | instaopener.ru |
PERL5LIB | /usr/share/awstats/lib:/usr/share/awstats/plugins |
REQUEST_SCHEME | https |
HTTPS | on |
UNIQUE_ID | ZgblKfRNJpJoj5AHgVqLDAAAAFA |
REDIRECT_STATUS | 200 |
REDIRECT_PERL5LIB | /usr/share/awstats/lib:/usr/share/awstats/plugins |
REDIRECT_REQUEST_SCHEME | https |
REDIRECT_HTTPS | on |
REDIRECT_UNIQUE_ID | ZgblKfRNJpJoj5AHgVqLDAAAAFA |
FCGI_ROLE | RESPONDER |
DEBUG | true |
LOCAL | false |
DB_HOST | 127.0.0.1 |
DB_NAME | u0649442_default |
DB_USER | u0649442_default |
DB_PASS | 8WEBR!Vg |
HOST_INFO | http://example.com |
API_BOT | 653503651:AAG9MZOQvHHoQrPczjFoBt4crCLVOmxZu1Y |
BOT_NAME | instaOpener_bot |
BASE_URL_TELEGRAM | https://t.me/ |
DOMAIN | instaopener.ru |
SENTRY_DSN |