2017 © Pedro Peláez
 

library used_files_mapper

Small library to help debugging apps by logging the used php files

image

infog/used_files_mapper

Small library to help debugging apps by logging the used php files

  • Tuesday, February 6, 2018
  • by InFog
  • Repository
  • 1 Watchers
  • 2 Stars
  • 28 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

UsedFilesMapper

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)

Usage

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)

Keeping the log

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);

Generating the heatmap

In order to generate the report you will need the log file and the application's code base., (*8)

Here is an example:, (*9)

  • The files on the server are under /app/website
  • After collecting the usage for some time you downloaded the report into ~/Desktop/usedfiles.log
  • The codebase is under ~/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

License

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)

The Versions

06/02 2018

dev-master

9999999-dev

Small library to help debugging apps by logging the used php files

  Sources   Download

GPL3 GPL-3.0-or-later

by Evaldo Junior

25/06 2017

0.3.0

0.3.0.0

Small library to help debugging apps by logging the used php files

  Sources   Download

GPL3

by Evaldo Junior

25/06 2017

0.2.0

0.2.0.0

Small library to help debugging apps by logging the used php files

  Sources   Download

GPL3

by Evaldo Junior

25/06 2017

0.1.0

0.1.0.0

Small library to help debugging apps by logging the used php files

  Sources   Download

GPL-v3

by Evaldo Junior