Add_Git_Notification #23
10 changed files with 156 additions and 5 deletions
|
@ -19,6 +19,7 @@
|
|||
"php-curl-class/php-curl-class": "^9.19",
|
||||
"symfony/cache": "^7.1",
|
||||
"phpoffice/phpspreadsheet": "^2.1",
|
||||
"symfony/polyfill-iconv": "^1.31"
|
||||
"symfony/polyfill-iconv": "^1.31",
|
||||
"monolog/monolog": "^3.7"
|
||||
}
|
||||
}
|
||||
|
|
103
composer.lock
generated
103
composer.lock
generated
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "05654f94aa961d630f571a3d533e8543",
|
||||
"content-hash": "bb114d3310ab85f9eb6fab629f30f427",
|
||||
"packages": [
|
||||
{
|
||||
"name": "doctrine/collections",
|
||||
|
@ -1524,6 +1524,107 @@
|
|||
},
|
||||
"time": "2022-12-02T22:17:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "monolog/monolog",
|
||||
"version": "3.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Seldaek/monolog.git",
|
||||
"reference": "f4393b648b78a5408747de94fca38beb5f7e9ef8"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Seldaek/monolog/zipball/f4393b648b78a5408747de94fca38beb5f7e9ef8",
|
||||
"reference": "f4393b648b78a5408747de94fca38beb5f7e9ef8",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1",
|
||||
"psr/log": "^2.0 || ^3.0"
|
||||
},
|
||||
"provide": {
|
||||
"psr/log-implementation": "3.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"aws/aws-sdk-php": "^3.0",
|
||||
"doctrine/couchdb": "~1.0@dev",
|
||||
"elasticsearch/elasticsearch": "^7 || ^8",
|
||||
"ext-json": "*",
|
||||
"graylog2/gelf-php": "^1.4.2 || ^2.0",
|
||||
"guzzlehttp/guzzle": "^7.4.5",
|
||||
"guzzlehttp/psr7": "^2.2",
|
||||
"mongodb/mongodb": "^1.8",
|
||||
"php-amqplib/php-amqplib": "~2.4 || ^3",
|
||||
"phpstan/phpstan": "^1.9",
|
||||
"phpstan/phpstan-deprecation-rules": "^1.0",
|
||||
"phpstan/phpstan-strict-rules": "^1.4",
|
||||
"phpunit/phpunit": "^10.5.17",
|
||||
"predis/predis": "^1.1 || ^2",
|
||||
"ruflin/elastica": "^7",
|
||||
"symfony/mailer": "^5.4 || ^6",
|
||||
"symfony/mime": "^5.4 || ^6"
|
||||
},
|
||||
"suggest": {
|
||||
"aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
|
||||
"doctrine/couchdb": "Allow sending log messages to a CouchDB server",
|
||||
"elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
|
||||
"ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
|
||||
"ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler",
|
||||
"ext-mbstring": "Allow to work properly with unicode symbols",
|
||||
"ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
|
||||
"ext-openssl": "Required to send log messages using SSL",
|
||||
"ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)",
|
||||
"graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
|
||||
"mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
|
||||
"php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
|
||||
"rollbar/rollbar": "Allow sending log messages to Rollbar",
|
||||
"ruflin/elastica": "Allow sending log messages to an Elastic Search server"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-main": "3.x-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Monolog\\": "src/Monolog"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jordi Boggiano",
|
||||
"email": "j.boggiano@seld.be",
|
||||
"homepage": "https://seld.be"
|
||||
}
|
||||
],
|
||||
"description": "Sends your logs to files, sockets, inboxes, databases and various web services",
|
||||
"homepage": "https://github.com/Seldaek/monolog",
|
||||
"keywords": [
|
||||
"log",
|
||||
"logging",
|
||||
"psr-3"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Seldaek/monolog/issues",
|
||||
"source": "https://github.com/Seldaek/monolog/tree/3.7.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/Seldaek",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-06-28T09:40:51+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nikic/fast-route",
|
||||
"version": "v1.3.0",
|
||||
|
|
|
@ -6,4 +6,6 @@ DISCORD_CLIENT_SECRET=""
|
|||
DISCORD_CLIENT_LOGIN_URI=""
|
||||
|
||||
DB_DRIVER="pdo_sqlite"
|
||||
DB_PATH="/app/data/db.sqlite"
|
||||
DB_PATH="/app/data/db.sqlite"
|
||||
|
||||
LOG_PATH="/app/data/php.log"
|
|
@ -37,5 +37,7 @@ final class ContainerHandler
|
|||
$reflectionContainer = new ReflectionContainer(true);
|
||||
self::$instance->delegate($reflectionContainer);
|
||||
self::$instance->addShared(Container::class, self::$instance);
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -4,10 +4,14 @@ namespace GamesShop;
|
|||
use GamesShop\Environment\EnvironmentHandler;
|
||||
use GamesShop\Templates\TemplateEngine;
|
||||
use League\Container\Container;
|
||||
use Monolog\Logger;
|
||||
use Throwable;
|
||||
use Whoops\Handler\CallbackHandler;
|
||||
use Whoops\Handler\HandlerInterface;
|
||||
use Whoops\Handler\PrettyPageHandler;
|
||||
use Whoops\Inspector\InspectorInterface;
|
||||
use Whoops\Run;
|
||||
use Whoops\RunInterface;
|
||||
|
||||
final class CrashHandler
|
||||
{
|
||||
|
@ -32,7 +36,7 @@ final class CrashHandler
|
|||
}
|
||||
|
||||
return new CallbackHandler(
|
||||
function ($exception, $inspector, $run) {
|
||||
function (Throwable $exception, InspectorInterface $inspector, RunInterface $run) {
|
||||
http_response_code(500);
|
||||
echo ContainerHandler::get(TemplateEngine::class)
|
||||
->renderErrorPage(500);
|
||||
|
|
|
@ -42,4 +42,8 @@ final class EnvironmentHandler
|
|||
{
|
||||
return $_SERVER['USE_SSL'] === 'true';
|
||||
}
|
||||
|
||||
public function getLoggingPath(): string {
|
||||
return $_SERVER['LOG_PATH'] ?? '';
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ namespace GamesShop\Errors;
|
|||
|
||||
use Exception;
|
||||
use GamesShop\ContainerHandler;
|
||||
use Monolog\Logger;
|
||||
use Whoops\Handler\HandlerInterface;
|
||||
use Whoops\Handler\PrettyPageHandler;
|
||||
|
||||
|
@ -14,6 +15,12 @@ final class ExtendedException extends Exception
|
|||
public function __construct(string $message = "", array $additionals = [], int $code = 0, ?Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
|
||||
ContainerHandler::get(Logger::class)
|
||||
->error(
|
||||
$message,
|
||||
$additionals
|
||||
);
|
||||
|
||||
$handler = ContainerHandler::get(HandlerInterface::class);
|
||||
|
||||
|
|
25
src/php/Services.php
Normal file
25
src/php/Services.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php declare(strict_types=1);
|
||||
|
||||
namespace GamesShop;
|
||||
|
||||
use GamesShop\Environment\EnvironmentHandler;
|
||||
use Monolog\Handler\StreamHandler;
|
||||
use Monolog\Level;
|
||||
use Monolog\Logger;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
final class Services
|
||||
{
|
||||
|
||||
public static function createLogger(): void
|
||||
{
|
||||
$logPath = ContainerHandler::get(EnvironmentHandler::class)->getLoggingPath();
|
||||
|
||||
$logger = new Logger('gamesshop');
|
||||
$logger->pushHandler(new StreamHandler($logPath, Level::Debug));
|
||||
|
||||
ContainerHandler::getInstance()
|
||||
->addShared(LoggerInterface::class, $logger)
|
||||
->setAlias(Logger::class);
|
||||
}
|
||||
}
|
|
@ -4,8 +4,10 @@ declare(strict_types=1);
|
|||
use GamesShop\ContainerHandler;
|
||||
use GamesShop\DoctrineManager;
|
||||
use GamesShop\Environment\EnvironmentHandler;
|
||||
use GamesShop\Services;
|
||||
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
ContainerHandler::get(EnvironmentHandler::class)->load();
|
||||
ContainerHandler::get(DoctrineManager::class)->setup();
|
||||
ContainerHandler::get(DoctrineManager::class)->setup();
|
||||
Services::createLogger();
|
|
@ -5,6 +5,7 @@ use GamesShop\ContainerHandler;
|
|||
use GamesShop\CrashHandler;
|
||||
use GamesShop\DoctrineManager;
|
||||
use GamesShop\Environment\EnvironmentHandler;
|
||||
use GamesShop\Errors\ExtendedException;
|
||||
use GamesShop\Routing\Router;
|
||||
use Laminas\HttpHandlerRunner\Emitter\SapiEmitter;
|
||||
use Whoops\Handler\HandlerInterface;
|
||||
|
@ -15,6 +16,8 @@ require_once __DIR__ . '/../src/php/bootstrap.php';
|
|||
|
||||
ContainerHandler::get(CrashHandler::class)->register();
|
||||
|
||||
throw new ExtendedException('Test', [ 'gell', 'Hub' ]);
|
||||
|
||||
$router = ContainerHandler::getInstance()->get(Router::class);
|
||||
$result = $router->route();
|
||||
|
||||
|
|
Loading…
Reference in a new issue