GithubHelp home page GithubHelp logo

wheels00 / phpcallgraph Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wooknight/phpcallgraph

0.0 2.0 0.0 5.54 MB

A Call Graph Generator for PHP

License: GNU General Public License v3.0

PHP 99.30% Batchfile 0.01% Shell 0.06% Roff 0.63%

phpcallgraph's Introduction

phpCallGraph

    A tool to generate static call graphs for PHP source code.
    The graphs can be leveraged to gain a better understanding of
    large software systems or even to debunk design flaws in them.

    http://phpcallgraph.sourceforge.net/


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


Usage:
     Go to folder bin and run phpcallgraph.
     The generator requires at least PHP 5.2.

     In order to generate output formats other that 'txt' or 'cga'
     the Graphviz toolkit which can be downloaded at
     http://www.graphviz.org/ is required.

     For the 'umlgraph' output format you need pic2plot, which is part of the
     GNU plotutils package.

     bin/phpcallgraph [-f <string>] [-o <string>] [-r] [-d <string>] [-n] [-p] [-a <string>] [-v] [-g] [-h] [--] <string:sources> [<string:sources> ...]

Arguments:
    <string:sources>        Files and/or directories to analyze

Options:
    -f / --format           Set output format. Can be 'txt', 'array', 'umlgraph'
                            'deadcode', 'cga' or one of the formats supported
                            by dot, e.g. png, svg, pdf, ps, ...
                            (see http://graphviz.org/doc/info/output.html)
    -o / --outputfile       Output file
    -u / --umloutputdir     UML output directory (only used for the umlgraph output
                            format
    -r / --recursive        Analyze directories recursive
    -d / --dotcommand       Set dot command
    -i / --ignore           Set a regular expression for files or folders to ignore
    -n / --noexternalcalls  Do not show calls to methods or functions which are
                            external to a class
    -p / --phpfunctions     Show calls to internal PHP functions
    -a / --autoload         Sets a PHP file with an autoload function which will
                            be included into the sandbox of the InstantSVC
                            CodeAnalyzer
    -v / --verbose          Verbose mode for text output format
    -g / --debug            Print debug information
                            (helpful if you get no output at all, since it
                            shows errors during code analysis)
    -h / --help             Display help

3D Graph Exploration:
    You can use the CGA framework available at http://cgs.hpi.uni-potsdam.de/trac/cga/
    to explore the graph with elaborate 3D visualization techniques.

    In order to generate input file for CGA set the format option to `cga', e.g.

        phpcallgraph -f cga -o testfiles.str test/testfiles/

Analysis of code in the global scope:
    Code in the global scope (outside any functions or methods) can be analyzed
    with the help of a little workaround: Such code can be manually wrapped in
    a dummy function called dummyFunctionForFile_filename_php() which will then
    be recognized by phpCallGraph. Of course this is not very elegant but
    currently the only feasible way due to some conceptual restrictions
    resulting from the utilization of the InstantSVC CodeAnalyzer.

Dead Code Detection
    You can get a list of methods and functions which are never called by using
    the output format 'deadcode', e.g.

        bin/phpcallgraph -r -f deadcode test/testfiles/

Examples:
    bin/phpcallgraph -n -f png -o PHPCallGraph.png src/PHPCallGraph.php
    bin/phpcallgraph -f png -o phpcallgraph-library.png src/drivers/ src/PHPCallGraph.php
    bin/phpcallgraph -r -f png -o phpcallgraph-src.png src/
    bin/phpcallgraph -r -f png -o phpcallgraph.png src/ lib/
    bin/phpcallgraph -r -p test/testfiles/
    bin/phpcallgraph -p -- test/testfiles/Foo.php test/testfiles/Bar.php
    bin/phpcallgraph -r -f array test/testfiles/ | php -r '$a = unserialize(file_get_contents("php://stdin")); var_export($a);'
    bin/phpcallgraph -r -f deadcode test/testfiles/
    bin/phpcallgraph -g -r -i "PHPCallGraph.php|lib/ezcomponents" -f png -o phpcallgraph-src1.png src/ lib/

Authors:
    Falko Menge <fakko at users dot sourceforge dot net>
    Till Klampaeckel <till at php dot net>
    Christian Weiske <cweiske at php dot net>
    Martin Cleaver <mrjc at users dot sourceforge dot net> (UmlGraphSequenceDiagramDriver)

phpcallgraph's People

Contributors

wooknight avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.