How to create flowcharts to understand PHP code execution in a web application

Hi,

I have a huge PHP based web application which I am trying to decode. I want to create diagrams like flowchart or any other type (which will be recommended by EE experts) to understand the how exactly is the PHP code being executed and what is happening with the PHP code when a page is opened or a link is clicked or a form is submitted etc.

I am not able to understand where do I start or how do I create the diagrams.

Kindly let me know a tool which can easily help me create the necessary diagrams or any references where diagrams have been created for web applications.

Kindly let me know if any more information is required.

Thanks in advance.
LVL 1
Vipin KumarSr. Network EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kanti PrasadCommented:
Hi

I use the below free online one and it served my purpose

https://www.draw.io/
Ray PaseurCommented:
I'm guessing that this application is older and not constructed in an object-oriented design.  This may not be the answer you want to hear, but I would never apply a flow chart to a modern application.  Flowcharts are kind of a 1980's approach to understanding software.  Today there are other tools that can help you understand and refactor the application.  And with older PHP applications, refactoring is going to be necessary, since many of the design flaws of early PHP are disappearing from the language.

Modern applications use object-oriented designs.  Typically they consist of many small classes, each having a single responsibility.  The structure of the data and the interaction between the classes is what we map out today, as opposed to the flow of program logic.  This article can help familiarize you with some of the modern design principles.
http://www.experts-exchange.com/articles/18329/SOLID-Design-in-PHP-Applications.html

I have not read all of it yet, but this link appears to be pretty good:
http://agiledata.org/essays/mappingObjects.html

You might want to try to describe the app's functionality with story-driven modeling and CRC cards.
https://en.wikipedia.org/wiki/Class-responsibility-collaboration_card

For a quick "scratch the surface" reference, this seems useful:
https://sourcemaking.com/design_patterns

You may want to read Martin Fowler's work on design patterns:
http://martinfowler.com/books/eaa.html
Vipin KumarSr. Network EngineerAuthor Commented:
@Ray.. The application is a modern application and it works based on object-oriented design. I will go through the links that you provided. But still I would like to know what approach you would take if you get an application on your hand and you have to understand the complete flow of the application and what approach you would suggest me other than those mentioned above.
Ray PaseurCommented:
That's good news.  I would probably start by printing out the CREATE TABLE statements and any queries or stored procedures.  Next, I would use my time for reading the code.  The CRC cards are really helpful.
Kanti PrasadCommented:
Hi

Go with the frist talking to people who worked on that application which will give you much in sites of the application.

Then follow the below

1. End Goal \ Business purpose \ business functionality the application is offering.
2. If someone can you a knowledge transfer of how the application architecture
3. What major components,  models, templates,  controllers etc it has
4.Use an IDE & debut a few functionalities to know the logic gets the desired output
5 For the functionality, you are going thru use draw.io and go to UML section and you can create use cases, object diagrams, class diagrams, Component diagrams, Activity diagrams, Sequence diagrams etc
6 As all applications follow some framework once you go thru a few you will get an idea of what is in and then go about your business as usual activities of enhancing or support that application.
7 Look at the table structures, the date in it and if there are any reports generated look at the date from those reports which will give you business side of things.

As a couple of tools to understand  your code

The included extension (quoting) : Allows you trace through and dump the hierarchy of file inclusions and class inheritance at runtime
Xdebug + KCacheGrind will allow you to generate call-graphs ; XHProf should do the same kind of thing.
Using your IDE (Eclipse PDT, Zend Studio, phpStorm, netbeans), ctrl+click on a class/method should bring you to its declaration.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.