Skip to content

Commit

Permalink
refactor: 🎨 split files (and more refactoring)
Browse files Browse the repository at this point in the history
- 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/
  • Loading branch information
schuhwerk committed Jan 29, 2022
1 parent 5db148e commit d3f3948
Show file tree
Hide file tree
Showing 16 changed files with 710 additions and 465 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

vendor/

composer.lock
.phpunit.result.cache
*.code-workspace
21 changes: 19 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,22 @@
"issues": "https://github.com/schuhwerk/php-error-log-viewer/issues",
"source": "https://github.com/schuhwerk/php-error-log-viewer"
},
"type": "development-tool"
}
"type": "development-tool",
"config": {
"sort-packages": true,
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"require-dev": {
"phpunit/phpunit": "^9",
"squizlabs/php_codesniffer": "^3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7"
},
"scripts": {
"test": "phpunit",
"phpcs": [
"vendor/bin/phpcs --standard=phpcs.xml --extensions=php"
]
}
}
28 changes: 28 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

/**
* PHP Error Log Viewer.
* Check readme.md for more information.
*
* Disclaimer
* - This contains code for reading & deleting your log-file.
* - Log files might contain sensitive information.
* - It is meant for development-environments
*/

namespace Php_Error_Log_Viewer;

require_once 'src/LogHandler.php';
require_once 'src/AjaxHandler.php';

$path = 'php-error-log-viewer.ini';
// search settings directly outside the vendor folder.
$settings = file_exists('../../' . $path) ? parse_ini_file('../../' . $path) : array();
// search settings in the same folder as the file.
$settings = file_exists($path) ? parse_ini_file($path) : $settings;

$log_handler = new LogHandler($settings);
$ajax_handler = new AjaxHandler($log_handler);
$ajax_handler->handle_ajax_requests();

readfile('./src/error-log-viewer-frontend.html');
Binary file added php-error-log-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d3f3948

Please sign in to comment.