1

Suppose that we have a simple web app consists of following valid pages:

login.php  (params: username, password)
index.php  (params: product_id)
product.php

When we enter the username and password in the login.php page, we will go to the index.php page. Now, when we we enter a number in the product_id field in the index.php page, we will go to the product.php page. So, the structure of the web app is:

login.php ---(username, password)---> index.php ---(product_id)---> product.php

In other words, I want something like this in a graph or any structure:

Structure of the simple web app

I would like to know is there a tool, something like a php code analyzer, call graph, control flow and so forth, to give me this structure using the web app source code?

Linux or Windows, budget is not important now.

9
  • When you are only interested in php, maybe doxygen (stack.nl/~dimitri/doxygen) can be of help as it gives the relations between functions (also when in different files). Thanks @Izzy who gave the idea by means of the shown graph.
    – albert
    Apr 24, 2018 at 8:15
  • 1
    @izzy, no doxygen would not be able to do that, doxygen analyses the source code. Analyzing logs only gives an indication as it only shows the used-paths and not all possible paths.
    – albert
    Apr 24, 2018 at 8:20
  • 1
    Ouch, so your suggestion @albert would be the correct answer and mine is not; I have missed the "using the web app source code" part …
    – Izzy
    Apr 24, 2018 at 8:27
  • 1
    @albert Visitors only works on web server logs (i.e. after the pages have been called) and does not list all possible connections, but just those users followed. Richard more likely wants to list all possible connections before the web app is deployed – in which case visitors is no help. OTOH, I'm not sure that Doxygen creates a page dependency graph (AFAIR it rather cares about functions, classes etc.); but never having used it, I cannot tell for sure.
    – Izzy
    Apr 24, 2018 at 8:35
  • 1
    @izzy doxygen does not create a page dependency, but I think it will give some good pointers for Richard.
    – albert
    Apr 24, 2018 at 8:41

2 Answers 2

1

Visitors would match your requirements. It is an open source, fast and easy to use web log analyzer which generates access statistics from specified web log files. Included is the functionality to create Graphviz input files showing the access paths of your website visitors.

Development seems to have stopped in 2006. If you're on Debian based Linux, my repository has an amd64 package I've build in 2015, including all the Debian patches as of 0.7-9, plus some updates for OS and browser detection. Here's an example graph:

example graph
Example graph (source: Visitors; click image for larger variant)

I can confirm it at least works fine with Apache logs (that's what I tried it with in 2015).

3
  • I've just now noticed the "using the web app source code" condition in your question, Richard – so my answer is not a complete match. Let me know if I should remove it.
    – Izzy
    Apr 24, 2018 at 8:29
  • Don't remove it. Maybe the answer is helpful for another one. But I think it doesn't give the structure I mentioned in my question.
    – Richard
    Apr 24, 2018 at 10:49
  • It probably would ignore the parameters, yes. Apart from that, the structure should match – but you'd need a tool to "click all links" (i.e. automatically runs all "options" a page gives) – and a test environment to run it in, if you want to have those details before publication.
    – Izzy
    Apr 24, 2018 at 13:40
1

Doxygen might be the way to go. It supports php and can analyze the code and generate documentation from it as well as call / caller graphs.

9
  • 1
    I don't think Doxygen is useful for my purpose. I just want the page dependency as I mentioned in my question. I thought this is a simple question and there should be a tool to do this!
    – Richard
    Apr 24, 2018 at 10:45
  • 1
    Did you do a quick test with doxygen to seen whether or not it gives some pointers? (Otherwise post a MWE that shows your needs in doxygen e.g. on stackexchnage itself and tag it with doxygen) Maybe you could e.g. postprocess the xml output.
    – albert
    Apr 24, 2018 at 10:53
  • 1
    Yes, it is strange that it gives all the classes and functions relation, but it doesn't give the pages relation with their passing parameters!
    – Richard
    Apr 24, 2018 at 15:23
  • 1
    This is not strange, in other languages the concept "page" is not present but only function, classes etc. files have no direct meaning.
    – albert
    Apr 24, 2018 at 15:43
  • 1
    Cross posted to: stackoverflow.com/questions/50006168/…
    – albert
    Apr 24, 2018 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.