tags:

views:

312

answers:

4

I have a relatively simple application up and working with some basic functionality which i have built as a bit of a project. I would like to now build on that, and add some more complex features, including login.

The code has got quite complex, and it's written in plain php, so all the presentation code is mixed in with the logic. I have decided that before I go any further I'd like to re factor it to separate this out, so it's easier to maintain and add to. I've been researching MVC and think that's the way i should be going.

I had decided to give the zend framework a go, and have spent a while trying to get to grips with it, however I have found the learning curve extremely steep as I have no object oriented experience.

Is there another framework or option that anyone could recommend? I am considering having a look at cake based on reading other posts in this forum but I'd accept any guidance - my "requirments" are

  • easiest to learn for non OO experience
  • includes some login / authentication features
  • handles database interaction with mysql easily.

All suggestions appreciated!

+1  A: 

I've personally used Symfony. It's a very complete and well-supported framework which is relatively easy to get started with. My experience with frameworks is that for simpler projects they can be quite a burdon.

Gabri van Lee
+3  A: 

Smarty templating engine.

http://www.smarty.net/

Jobo
+4  A: 

As stated very eloquently here already, frameworks are good until you want to do something they're not suited for, plus they can abstract the language to the point where you're effectively learning them rather than the language you're coding in.

I would encourage you to roll your own. If you understand the principles of MVC and you have a fair-to-middling knowledge of PHP then it won't be too hard (there's already several pointers around), plus you'll come out of it far further ahead than if you'd just used someone else's.

da5id
Thanks for the info da5id, the pointers gave me a lot of food for thought and I've been working on my own set up. The language abstraction was what did it for me - felt like i was learning something completely new
Rob Y
+1  A: 

The people at my workplace swear by Cake. It does seems to be quite flexible and certainly fast to develop with once you know it. However, I would echo da5id and say that it's always safest to build your own - you know exactly how it works, you get some good PHP experience (instead of Cake experience), and you don't have to spend hours either fighting with it to get it do do what you want, or reading up on how to use it in the first place.

I am not at all convinced that "MVC" really exists as a paradigm in PHP incidentally - the V and the C are so hopelessly intertwined in most cases because the form is the view.

Build yourself a code generator that will output PHP classes based on your database tables. If you're really clever you can get it to inspect the database for relationships and even build the joins in PHP too. Then create a second set of classes that each inherit from the table-based-class that lets you customize its behaviour. Rely on these secondary classes in your business code. (It's a form of the Generation Gap pattern)