views:

138

answers:

2

The problem:

I have a legacy php app that is coded in no particular style (some OO, function libraries, some templates, no templates), which I am slowly rewriting, cleaning up, and adding to.

When I introduced templates to the system, it was immediately evident that that would really clean up and simplify the code a lot because of the separation between html and php that it gives. I've worked with a php MVC framework at my job, and I really like the separation of concerns that embodies the concept of the MVC. However, I don't like the complexity that a large codebases would introduce. I love simplicity and can't deal well with endlessly nested debugging when a really complex stack comes into play. As time goes on, I have become more and more of a fan of functional style, mainly due to investigations into Clojure.

I would like to have a good way to separate out concerns in php, optimally without much object oriented code, and without much of a stack, because I want to move to a more functional style for php as I move to php 5.3 and beyond.

Framing the solution:

  • No large/complicated objects.
  • A short stack for debugging.
  • Running php 5.2, won't be able to upgrade to 5.3 until whenever it comes out in debian, so functional style would be nice, but the tools of 5.3 might not be available to me for a while.
  • A clean & simple theme to unify a currently fractured codebase.
  • The less impact on the current code, the better.
+3  A: 

I can't vouch for it, but I've heard some good things about Kohana

easement
+1, because Kohana is awesome. :)
MatW
Kohana is cool, but given that the OP said he doesn't want OOP nor MVC, I don't see how it applies...
sprugman
I downloaded it, and will have to check out the code, because, who knows, it might be a good change of direction, despite that that's not the FP direction I was hoping to go next. *shrugs*
Tchalvak
Close as I'm gonna have a suggestion for, I guess.
Tchalvak
+1  A: 

If you're building a complex site a framework like kohana will help a lot. For simpler websites I prefer not to use frameworks. I go with a barebones "framework" thats basically just a front controller with some helper functions.

the front controller looks at the request and decides which controller/page to load. The loaded controller/page gets the data it needs via models/whatever and then loads a template.

request = /blog/13/i-like-birds front controller looks at request and loads the blog controller blog controller gets all the info it needs for post 13 and loads the blog template.

But again, which solution you should use depends on the needs of the site.

Galen
It's hard for me to say whether it's a simple site or not? I tend to think that it isn't simply because it's not designed around jus' displaying web pages, but more around being a web app.Anyway, I'm fine with using code that other people wrote, I just down want to be trapped by it or have to rewrite all the stuff that exists to match it.
Tchalvak