定制 infog/used_files_mapper 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

infog/used_files_mapper

Composer 安装命令:

composer require infog/used_files_mapper

包简介

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

README 文档

README

This library will log the php files used by your PHP application.

The idea here is to understand which parts of your code are used and which are not, so it is safer to remove them.

This library can be specially useful when upgrading PHP versions or even to learn more about a new codebase.

It works by having a log of the used files and then making a usage report out of those files.

Usage

Simply register the mapper in your index file passing a filename to write the output to:

<?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.

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:

<?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.

Here is an example:

  • 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:

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.

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.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

统计信息

  • 总下载量: 69
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2017-06-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固