3

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

4 Answers 4

5

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.

1

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.

0

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.

-1

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

5
  • "one of the good frameworks". There are no good frameworks.
    – Raynos
    Jul 22, 2011 at 9:00
  • 1
    Some are better than others.
    – Andy Hunt
    Jul 22, 2011 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? Jul 22, 2011 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, 2011 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? Jul 22, 2011 at 13:46

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