Re: Architecture patterns in PHP
| From: | Nathan Nobbe | Date: | Sun, 28 Dec 2008 22:38:07 +0000 |
| Subject: | Re: Architecture patterns in PHP | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-285165@lists.php.net to get a copy of this message | ||
On Sun, Dec 28, 2008 at 3:29 PM, Michael C. Yates <quwieu@gmail.com> wrote:
> Nathan Nobbe wrote:
>
>>
>>
>> Hey,
>>>
>>> How do you structure your web applications? I am thinking in terms of
>>> separating presentation and logic. How is that done in PHP?
>>>
>>
>> mvc is pretty popular, but php is so flexible you often don't need it for
>> smaller applications.
>>
>> For example, if you take a page-controller approach, a php app is dead
>> simple. You have a seperate entery point for evrything; login.php,
>> register.php, etc could be considered controllers, then all your common
>> logic comes in via some includes, hopefully files outside the webroot. then
>> you have some template directory w/ files that are a mixture of php and
>> html(for example). your 'controller' files include the library code, hit
>> the db (if necc.) and then stuff data into the templates for output.
>>
>> if you want to see an exmple if a more traditional mvc there are scads of
>> open source frameworks out there which use a front controller approach. Code
>> igniter is really straight forward, you can probly learn quickly from it.
>>
>>
>
> Thanks for the reply.
>
> Does anyone know of a good written guide about patterns like Front
> controller, Page Controller, MVC etc. and how they are implemented in PHP?
>
> I found something about these patterns in a guide on MSDN called Enterprise
> Solution Patterns Using Microsoft .NET (
> http://msdn.microsoft.com/library/ms998516(en-us?‰Žþ°B�^F%®1
> ø).aspx<http://msdn.microsoft.com/library/ms998516%28en-us%29.aspx>
> ).
>
> It describes MVC, Page Controller, Front Controller and a lot of other
> patterns for ASP.NET applications.
>
> Something like this for PHP would be cool.
i used to be a pretty big fan of
http://www.phppatterns.com
its a bit dusty (not updated in years) but a lot of the material is still
relevant, its free, and imo a great starting point.
also, google is your friend ;)
-nathan