Small library to help debugging apps by logging the used php files
This library will log the php
files used by your PHP application., (*1)
The idea here is to understand which parts of your code are used and which are not, so it is safer to remove them., (*2)
This library can be specially useful when upgrading PHP versions or even to learn more about a new codebase., (*3)
It works by having a log of the used files and then making a usage report out of those files., (*4)
Simply register the mapper in your index file passing a filename to write the output to:, (*5)
<?php use InFog\UsedFilesMapper\FilesMapper; FilesMapper::register('/tmp/usedfiles.log');
After running your application you will see a list of used files in the log file passed to the register method., (*6)
Do you want to use the report command to generate a nice HTML page containing
a list of the used files? Then you should keep the used files in the log file
using the MODE_APPEND
option:, (*7)
<?php use InFog\UsedFilesMapper\FilesMapper; FilesMapper::register('/tmp/usedfiles.log', FilesMapper::MODE_APPEND);
In order to generate the report you will need the log file and the application's code base., (*8)
Here is an example:, (*9)
/app/website
~/Desktop/usedfiles.log
~/Projects/website
The report can be generated using the following commands:, (*10)
cd ~/Projects/website ./vendor/infog/used_files_mapper/bin/report . /app/website/ ~/Desktop/usedfiles.log /tmp/report.html
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version., (*11)
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details., (*12)
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/., (*13)