Before even starting to think about code layout, there's a phase we don't know what else to call but "getting things together." This is the intermediate step between the idea and the specs/code layout stage—figuring out the inner workings and on what to base them.
To make it clearer, let's go back to the very beginning:
What do we want to create?
How are we going to create it?
Are there any existing implementations of our idea already?
Do similar systems exist that perform almost the same task?
If so, can we reuse anything from that design?
Can we reuse foreign techniques, maybe add up to our system with them?
Questions over questions.
The first is easy to answer. We want to create a chat system. How? Well, with PHP, and somehow ...