Skip to content

Commit d3f3948

Browse files
committed
refactor: 🎨 split files (and more refactoring)
- split the single php file in multiple files. - update readme ( file->folder, new screenshot, ideas section) - add php unit tests (for file-parsing) with test data. - add phpcs with coding standards (PSR12). - add travis support. This is no longer a single-file gui! The path for the viewer changed, you no longer open http://example.com/php-error-log-viewer/php-error-log-viewer.php but https://examle.com/php-error-log-viewer/
1 parent 5db148e commit d3f3948

16 files changed

+710
-465
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
21
vendor/
3-
42
composer.lock
3+
.phpunit.result.cache
4+
*.code-workspace

composer.json

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,22 @@
2727
"issues": "https://github.com/schuhwerk/php-error-log-viewer/issues",
2828
"source": "https://github.com/schuhwerk/php-error-log-viewer"
2929
},
30-
"type": "development-tool"
31-
}
30+
"type": "development-tool",
31+
"config": {
32+
"sort-packages": true,
33+
"allow-plugins": {
34+
"dealerdirect/phpcodesniffer-composer-installer": true
35+
}
36+
},
37+
"require-dev": {
38+
"phpunit/phpunit": "^9",
39+
"squizlabs/php_codesniffer": "^3",
40+
"dealerdirect/phpcodesniffer-composer-installer": "^0.7"
41+
},
42+
"scripts": {
43+
"test": "phpunit",
44+
"phpcs": [
45+
"vendor/bin/phpcs --standard=phpcs.xml --extensions=php"
46+
]
47+
}
48+
}

index.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/**
4+
* PHP Error Log Viewer.
5+
* Check readme.md for more information.
6+
*
7+
* Disclaimer
8+
* - This contains code for reading & deleting your log-file.
9+
* - Log files might contain sensitive information.
10+
* - It is meant for development-environments
11+
*/
12+
13+
namespace Php_Error_Log_Viewer;
14+
15+
require_once 'src/LogHandler.php';
16+
require_once 'src/AjaxHandler.php';
17+
18+
$path = 'php-error-log-viewer.ini';
19+
// search settings directly outside the vendor folder.
20+
$settings = file_exists('../../' . $path) ? parse_ini_file('../../' . $path) : array();
21+
// search settings in the same folder as the file.
22+
$settings = file_exists($path) ? parse_ini_file($path) : $settings;
23+
24+
$log_handler = new LogHandler($settings);
25+
$ajax_handler = new AjaxHandler($log_handler);
26+
$ajax_handler->handle_ajax_requests();
27+
28+
readfile('./src/error-log-viewer-frontend.html');

php-error-log-screenshot.png

232 KB
Loading

0 commit comments

Comments
 (0)