Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I would like to know which convention (if any) you use for your PHP web application projects.

share|improve this question

closed as primarily opinion-based by gnat, GlenH7, Bart van Ingen Schenau, Dan Pichelman, Kilian Foth Nov 12 '13 at 15:54

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

4 Answers 4

up vote 5 down vote accepted

I would say it depends on your application structure. Is this multisite? Is there a heavy need in configuration? Are there a lot of external libraries?

However, a good idea would be to get inspiration from existing frameworks (a better idea would be to use them), like symfony.

Important thing: separate your public files (i.e, the files that can be downloaded from the browser: css, js, html, etc.) from your app internal files. Doing this, you can configure a virtualhost to secure your installation, by serving only public files directly.

share|improve this answer

Look at PSR-0 PHP autoloader standard for an example of where an autoloader should look for files, and the Zend suggested app layout which uses the aforementioned autoloader.

The PSR-0 autoloader standard was created by several members of large PHP frameworks.

share|improve this answer

Well i don't think that depends on the language, just on your site design, I write web site staff with Perl and PHP (sorry don't use framework) and i basically organize it as this:

  • frontend/#Here what the user can see
  • backend/#Here what the user can't but is used by the frontend parts (database connection, etc...)
  • docs/#Here files where i document whatever i need
  • scripts/Every single script i write when is needed (database schema creation, some cronable scripts
  • img/#Website images
  • DB/ #database schema

But I guess is up to you.

share|improve this answer

MVC is pretty popular these days, usually under one of the good frameworks.

share|improve this answer
    
"one of the good frameworks". There are no good frameworks. –  Raynos Jul 22 '11 at 9:00
1  
Some are better than others. –  AndyBursh Jul 22 '11 at 9:04
    
@Raynos - "there are no good frameworks" - in general, applied to the entire programming niche or is that just your opinion of PHP frameworks? –  Michael J.V. Jul 22 '11 at 11:24
    
@MichealJ.V. It's a tongue in cheek comment. Most frameworks have their down sides. I havn't found any I personally like but I still use them. –  Raynos Jul 22 '11 at 12:23
    
Nothing is ever perfect :) but if something isn't good then it's the opposite. I'd say there's no framework satisfying your needs. Did you consider creating one or modifying existing ones? –  Michael J.V. Jul 22 '11 at 13:46

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