views:

639

answers:

11

Hello guys,

I want to start working on a project and this time around i want to make sure of a framework and see its like. i am having a little problem choosing a framework to work with. At the moment one of my motivations of using a framework is the MVC pattern. I know how useful it is. However, the framework i want to use must be an easy to learn and straight forward framework as i do not have much time. I see many people complain about understanding this frameworks. Since there is no time for me to start testing them one after the other, i need you guys to please give advises and guides as you have always been doing. Thanks very much.

+12  A: 

I would suggest CodeIgniter. It's fairly lightweight and easy to learn. Some other frameworks like CakePHP, Symfony and even Zend (even though you can pick and choose which parts you want to use) I think are a bit heavyweight. Or perhaps "invasive" is a better description. By that I mean that the framework then dicatates so much of what you do and how you do it that you're not really even doing PHP anymore, you're doing that framework.

There's no "right" framework in the absence of any frameworks. All of these frameworks have various pros and cons that make them more or less suited to particular applications or even just the development style of whoever is using them.

That all being said, theres nothing really magical about MVC that you couldn't do yourself by implementing a controller that simply does the work and then delegates to various views.

cletus
thanks for the swift response. I really appreciate it alot. Still on the topic and i do welcome more advise. Please tell me more about implementing my own MVC. Thanks
War Coder
I'll second cletus on CodeIgniter. It is the easiest to learn as the manual explains things in a very basic, clear manner. Something like Zend, which is more capable, suffers from a lack of simple explanation. They assume quite a lot and gloss over even more so if you don't really know the framework well, you could be utterly lost for quite a while. If you are just starting out, you'll get more done faster with CodeIgniter.
gaoshan88
I can't agree more. CodeIgniter is by far the simplest (and also one of the fastest/best performing) frameworks available for PHP. I like it because it's more of a library than a framework. It does do a few nice things for you (like MVC routing and some security things) but it's not invasive--you don't have to follow some pre-designed pattern. And, as a bonus, there's absolutely no reason why you couldn't use Zend Framework's components within CI. If you needed to use them for some project: http://freakauth.4webby.com/tutorials/using-zend-framework-components-in-code-igniter/ .
KyleFarris
its interesting to find out that i can use useful libraries from Zend Framework in CodeIgniter. CI is getting more attention from me now.
War Coder
+3  A: 

I really like Zend because it's components are very independent of each other. You can really pick and choose the parts you want to use, leave the parts you don't and it doesn't force you to change to any particular religion.

dicroce
A: 

As a rule I shy away from PHP frameworks. However, when I found myself in need of an OpenID client, I chose to use the Zend framework's implementation and have been very happy with that part at least.

Dinah
a framework is always a good think, and by framework i dont mean a public one like codeigniter, zend etc. i also mean a custom one.
solomongaby
+2  A: 

Or you could write your own... that is what I am trying to do, its a good learning experience.

SeanJA
hmmm, that is good.where are u learning it from? and can u share ur code with me?
War Coder
Since it is still a work in progress, it wouldnt be too useful to you, but the docs are being hosted at shoestringphp.com/docs at the moment
SeanJA
+2  A: 

For MVC, CodeIgniter is the way to go. It's extremely simple to set up, and provides really simple, easy methods for dealing with common problems. The one downside is that it destroys the _GET array in favor of a segmented URL scheme. If you building a page that requires a lot of GET parameters, and you want to use a normal querystring like the rest of the Internet, you need to do a bit of hacking.

Zend is really overcomplicated if you're most interested in MVC. My team had some real problems getting it up and running prompting the move to CodeIgniter.

Chris Henry
A: 

Now this is the million dollar question! I'm a big fan of CakePHP - utilizing the cake conventions and using the 'bake' command line interface, you can generate a full CRUD interface in literally a few minutes.

I would have to agree with Cletus in that there really is no 'best' framework. Spend some time and try and develop a basic CRUD application in the most popular to see which you prefer to work with.

Frameworks are essentially there to increase development speed, not to increase code speed.

Hope this helps!

+2  A: 

I'm using Kohana, which is a fork of CodeIgniter, optimised to take advantage of PHP5's better support for objects, and handy magic functions like __autoload()

alex
+4  A: 

I would recommend the Zend Framework above all other PHP frameworks.

I have really enjoyed working with the Zend Framework. There is a lot of support behind it and it's actively under development. They are practically shoveling out new features. Now with version 1.8, there are more features than ever. The MVC components alone are worth it. It has a ton of APIs and is integrated with Google, Amazon, Yahoo, and Flickr APIs, among others. Working with databases is a breeze. So is user management/user authentication. It is amazingly flexible. There is no configuration required to start using it. Just drop the directory in your project and start using it. You can include individual classes, or you can "bootstrap" your application and "autoload" all the Zend Framework classes (and your own). Also, the Zend Framework is continuously tested for bugs. Since it has a suite of unit tests, it makes it a RELIABLE framework to use. You can trust that it will work the way it's supposed to.

There is a ton of official documentation, though not always the easiest way to find out how to use something. Often I just search Google for tutorials that people have posted. There are a lot of them! Also, words of warning...since the Zend Framework has evolved so rapidly, a lot of the books/tutorials out on the web have become outdated. There aren't many books available that are up to date (especially now that 1.8 has introduced the Zend command line tool, adding a new way to approach starting a new project).

Also, I think learning the Zend Framework is a valuable skill. There are many new open source projects that are being built on the Zend Framework (Magento for example). Employers are also looking for people who have worked with the Zend Framework.

The Zend Framework is not perfect. There will be times when you become frustrated with it, but from my experience, there are lots of resources available to help you when you need it, and the Zend Framework is the way to go.

Andrew
i also enjoy working with Zend Framework, the best part i got from it was philosophy of making things as modular and loosely coupled as possible which is a thing i argue with some colleagues when i see they are not separating things and extending from abstract classes as much as it could be done :))
solomongaby
+2  A: 

I definitely second the CodeIgniter recommendation. It's an excellent MVC framework with an excellent documentation, well-written code and it's extremely easy for beginners to get a grasp of what the framework fuzz is all about. Based on personal experience, I do not recommend you start with a "heavyweight" framework like symfony or Zend, for example - especially if you don't have any experience from before, or are unsure or somewhat unexperienced with the MVC approach and how frameworks generally function. After you've gotten a grip of CodeIgniter, you could eventually move on to bigger frameworks - but it's not nescesarry! I've used CI for large scale applications with great success too!

I do not recommend writing your own as suggested before based on your input:

However, the framework i want to use must be an easy to learn and straight forward framework as i do not have much time.

It's an extremely time consuming task, expensive and possibly risky task if you're going to create a project that's going to be used by other people than you.

Best of luck!

loathsome
+1  A: 

I built a light weight framework myself and it was pretty easy to do, plus it allowed me to understand mvc on a deeper level.

I tried cake, and it really didn't make life any easier (it was difficult to learn and use simply... probably just need more experience with it). I think CodeIgniter might be better suited for me.

Basic design of mvc framework:

/.htaccess ->points all non existing files paths to index.php
/index.php ->handles all routing
/controllers/ ->these are run based upon the url (path is like yourdomain.com/controller_object/controller_method
/models/ ->these are your the objects that make up your site, and they interface with db
/views/ ->these are loaded after controller finishes. Mostly html, with <?=$var?> to fill in values. Views should map nicely with urls and controllers.

That's pretty much it (you will learn some details on the way, but that is the fun part).

You may decided to put your controllers, models and views outside of the public directory for security reasons (so someone can't access them directly).

RobKohr
do u mind sharing ur framework with me?
War Coder
A: 

These days I'm playing with Yii and their blog tutorial.

The other candidate is Agavi with the IBM DeveloperWorks tutorial series.

alexandrul