tags:

views:

309

answers:

7

So, I'm very tempted to rewrite my application using a php framework, as I think it'll make it easier for folks to get involved, as well as improving the design of the app.

CakePHP looks like the best of the PHP web frameworks. Does anyone have any experiences of it? What are the caveats I should consider going from handcoded PHP to using a framework?

+2  A: 

CakePHP has it's good parts but there is no "best" framework. Here's a thread with some clues about what's good in most popular PHP frameworks.

If you never used MVC frameworks before (and Cake is MVC framework) I think you should first familiaze yourself with MVC architecture.

RaYell
I've done MVC a little on a Rails project. Thanks for the pointer.
mattl
Why you won't rewrite your app in Rails then?
RaYell
Rails is pretty hard for people to deploy, and we want this to be as easy as possible. People should be able to throw this up on a $5 hosting account.
mattl
+8  A: 

Not depending on the framework you'll chose, the first thing you have to know is that :

  • it'll take some time for you to know it
  • you'll do crapping things, during that time ^^
  • so, take into account the fact it'll take some time before you are fully operational :-)

I think those points are the most under-estimated points : using a framework takes not much time... Using it well and to the full extend of its abilities takes... Well, a couple of months, maybe... Which means, when you are at the end of your project you'll say "I should rewrite that with all the stuff I learned while re-writing it the first time" :-D

What it means is : learn what the framework can do, learn how to use it, and use it for a while on small applications, before starting rewriting your big one !


Then, there is probably no "best framework" : one framework may be very well suited for one project, and another one may be best for a second, different project.

I've never worked with CakePHP ; I really like Zend Framework. But that is a personal opinion, and O know people who really like symfony ; they are not wrong : symfony is great -- and I am not wrong either ^^
Still, we sometimes agree on some things ; like the fact that Doctrine (default ORM layer of symfony) is really great stuff, and we tend to use in both symfony and ZF-based projects...


If motivated, you can take a look at many posts on SO, about frameworks... Here are a couple of those :

Good luck with those ^^
("Which framework" is a quite pationnating -- and subjective -- question ^^ )

Pascal MARTIN
For some reason, I thought the Zend Framework was proprietary. I guess I have some more research to do.
mattl
When it comes to writing my big app in the framework, we have already a fair chunk of developers, but we can always use more. Would you be interested in helping out?
mattl
There is a company (Zend) behind it, but, no, it's definitly not proprietary ; If I remember correctly, it is under some kind of BSD licence (and that's a great thing for users) ; see http://framework.zend.com/license -- and it's not the only framework with a company behind it ; symfony has one too, for instance
Pascal MARTIN
@mattl : thanks for the proposition! But I definitly don't have the time to engagne in anything like that :-( sorry :-(
Pascal MARTIN
+1  A: 

"CakePHP looks like the best of the PHP web frameworks."

This is subjective. You should compare the pros/cons of other PHP frameworks that will suit your needs.

These posts may help you:

http://stackoverflow.com/questions/2648/what-php-framework-would-you-choose-for-a-new-application-and-why

http://stackoverflow.com/questions/279003/why-do-i-need-to-use-a-popular-framework

http://stackoverflow.com/questions/249984/php-framework-decision-analysis-paralysis

Floetic
+1  A: 

FWIW, I used it for a time when I was doing some php development. I found it easy to use, and the rapid development aspect was great, and I would imagine has just gotten better in the last 3 years. There is a ton of help in the irc channel, and the documentation is good. I didn't stick around in PHP long enough to become an expert. However, I was just starting out as a programmer then, and ran into Larry Masters (the creator, aka phpnut) and he was just a good person to talk to about design principles, and an all around nice guy. Then again you don't have to be a super nice guy to write a good web framework (I'm looking at you DHH).

Anthony Potts
A: 

Most of the frameworks "bind" you to them, meaning you have to do things their way. If you want to do something they weren't designed to do, you usually have to hack it. For example, how many PHP frameworks currently support Facebook Connect?

Personally I prefer "frameworks" that you can use only the parts you want. Zend is like this, Doctrine and Propel are ORM that are designed to be used with other code. For example, the Symfony framework can use either.

Finally, I haven't found a popular PHP framework that scales well.

Brent Baisley
A: 

I have used cakephp for a couple of projects. From the moment I learned it I have never written php again without it (unless is fun code in which I want to try some new stuff, or learn other design ideas away from MVC). As mentioned, learning it will take some time. How much time it takes really depends on your background. If you have used another MVC framework for a web scripting language then you will learn it really quick; RoR developers will pick it up within hours/days. If you don't have experience with MVC frameworks then it might take you a little bit, but it will really save you time later on the road (including in that project you start with).

Until today, I still learn new things about CakePHP every time I start a new project on it, although I do dig into a lot of its source code (you definitely don't need to do this, documentation and help boards are more than enough).

I definitely recommend you looking into it. It will save you a lot of time and get your head thinking in a different way (if you are not used to the MVC).

Best of luck.

Alejandro
I noticed you commented on deployment. I have not had nay problems with deployment, it is as easy as moving it to the server (assuming your server is ready to run php code and has mod_rewrite) and changing some configuration files.
Alejandro
A: 

CakePHP's convention over configuration approach has a few advantages once you learn them:

  • it helps to keep you code organised and understandable
  • makes it easier for multiple developers to collaborate on the same application
  • makes it possible for developers to understand other developers' applications

You have two main options when rewriting a legacy application in CakePHP:

  • change the database schema to reflect the conventions - resulting in less code
  • code your models to interface with the legacy database - this book goes into all the details

Either way, once you have done the above, it's pretty much plain sailing, and a good learning experience.

deizel