SitePoint Sponsor

User Tag List

Results 1 to 14 of 14

Thread: PHP and MVC

  1. #1
    SitePoint Addict
    Join Date
    May 2003
    Location
    nyc
    Posts
    363
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP and MVC

    Hello All,

    Has anybody used MVC pattern while coding a site in PHP?

    james
    http://www.freelancedeveloper.org

  2. #2
    SitePoint Guru
    Join Date
    Oct 2001
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    First look in these forums? Half of the threads in this forum nowadays are about MVC. Take a look.

  3. #3
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Look also at 15seconds.com where they've recently done something about this - it's ASP but actually it's language independent right ?

    Also look at HarryF's site - phppatterns.com - more free plugging

  4. #4
    SitePoint Zealot
    Join Date
    Mar 2002
    Location
    Perth, Australia
    Posts
    164
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've just started investigating Phrame:
    http://phrame.sourceforge.net/

    Phrame is a web development platform for PHP based on the design of Jakarta Struts. Phrame provides your basic Model-View-Controller architecture, and also takes a step further adding standard components
    .....
    Anyone used it? Thoughts?

  5. #5
    SitePoint Wizard gold trophysilver trophy
    Join Date
    Nov 2000
    Location
    Switzerland
    Posts
    2,479
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Recommend picking up a copy of this month's php|arch - there's a good analysis of MVC using phrame in the general context of struts.

    Also have a read of this (PDF) it starts with a general discussion of MVC the gets specific to Krysalis (another framework) (from Interakt).

  6. #6
    public static void brain Gybbyl's Avatar
    Join Date
    Jun 2002
    Location
    Montana, USA
    Posts
    647
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've used Phrame... It's pretty much just the bare minimum classes that are present in Jakarta... They've got the Action classes, and some minimum ones from the java.lang package. They are good ports, but I tried using it on one of my recent projects and I found that I was still writing mostly the same classes because it didn't come out quite as comprehensive as I originally thought.
    Ryan

  7. #7
    SitePoint Guru
    Join Date
    Oct 2001
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I took a look at Phrame / Struts too and I found that it was a bit too limiting for a framework. For example, all Action Mappings need to be hard coded in an XML file. There is no way to load these dynamically from a database for example.

    Also, I don't like the way it validates forms. Form validation is done on the server-side only, and if you wanted to do client-side validation you'd have to hardcode the javascript yourself.

    I don't believe that a direct port of something from one language to another is per definition a success. Each language has its own specialities and perks. PHP, being dynamically typed, was designed specifically for the web while Java was designed for all sorts of applications. I think a MVC framework designed specifically for PHP can be a lot more suited to the language than a ported one.

    <shameless self-plug> in fact I've been thinking out / designing + refactoring such an MVC framework for about 8 months now </plug>

  8. #8
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    216
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm about to decide on some MVC framework that I want to use in all web development, maybe somebody can give some advice?

    So far I have basically heard of these frameworks:

    1) Fuse (www.fusebox.org). Come from Coldfusion, there is a PHP port which is said to be not ideal and not 100% bug free. So, not much support to be expected from that side. Not OO yet. The FLIP life cycle is interesting, but maybe that can be used seperately. Some good tools available (for prototyping and such), but again PHP is only a step child there.

    2) Phrame (http://phrame.sourceforge.net/). Is already version 2.0, so obviously has matured a bit. Comes from some university department, so there's probably some depth to it. I can't see wether somebody still developes it, though. No forum or anything, no news on the website. Seems a bit complicated, I don't understand the examples right away (but that doesn't have to mean much, of course). Very closely modeled on Jakarta Struts (wether this is good or not I cannot judge yet).

    3. Eocene (www.eocene.net). Is only developed by 1 guy so far. He seems to be knowing what he does though. I think I understand the (fairly decent) documentation. There is a forum at the website with a rather smallish user base (10-15 users), but at least there is some development going on right now. It seems to be more simplistic than Phrame, though. Does not yet include form validation, e.g. Good or bad? I don't know.

    4. Binary Cloud (http://www.binarycloud.com/). Seems to be very complete, but also really difficult. I don't really understand what going on there. Several websites, you can only get the program via CVS. Wether they are still developing it or not I couldn't really find out. Erm, is this an MVC framework at all? Or rather some sort of highly evolved class library? I'm not sure right now.

    So, has anybody some more experience with these frameworks? I would like to hear any opinions (haven't checked out the new php|arch issue yet). So far my favourite has been Eocene (mostly because it seems to be the most accessible to me), but I'm not sure.

  9. #9
    SitePoint Addict
    Join Date
    Mar 2003
    Location
    Germany
    Posts
    216
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But all in all it seems to me that surprisingly few people in the PHP community use one of these frameworks (apart from some who have invented their own)?

  10. #10
    SitePoint Guru
    Join Date
    Oct 2001
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My guess is that most of the PHP community hasn't "evolved" (so to speak) yet from the stage of writing spaghetti code, i.e. mixing all kinds of php logic with HTML output, and therefore these frameworks are considered simply as overhead that slows down their development work.

  11. #11
    SitePoint Member
    Join Date
    Dec 2002
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One of the other MVC frameworks that I've found rather interesting, and nicely documented as well, is ISMO (http://ismo.sourceforge.net/)

  12. #12
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Captain Proton - Yer, I can agree with that.

    You see a lot of this, though a majority of folks stay away from these frameworks simply because either they're too complex for their needs, they don't have an understanding of OOP, and/or take too long to learn to use and implement these frameworks properly.

    Which is a shame really since PHP has the stigma of badly written scripts which do use mixed markup.

    I've been guilty of this myself in the past though I am making efforts to learn Model-View-Controller for better design of scripts and how they're implemented and designed.

    It just takes time that's all I suppose ?

  13. #13
    ********* wombat firepages's Avatar
    Join Date
    Jul 2000
    Location
    Perth Australia
    Posts
    1,717
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ...or perhaps some think that if you really want MVC then you should be over at the JAVA forum? ... waiting for it to load

  14. #14
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)


    By which time they could be well on their way with PHP


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •