tags:

views:

782

answers:

10

Hi there,

I am just starting out in the PHP world. I have used asp.net mvc and come from a VS 2008 background..

I looked at PHP and it seems that a lot of the code is mixed in with the html... so I was looking for something to manage separation... I found

http://kohanaphp.com/home

but being a complete beginner in this i am unsure if its a good framework .... It uses the MVC pattern which should be good as i used this in other products...

I would really love some guidance..

I want to be able to start with PHP and i want to be able to keep as close as possible to PURE php but with a bit more separation (html and php code etc to help with maintainability )

Is MVC a good way to go? And is kohanaphp a good product, its open soruce as far as i can see but maybe there is a better alternative.

I have gone with the ZEND editor, well i have a trial ... it appears to be a general good editor for PHP?

Thanks

EDIT

Wow! thanks for such great feedback... So i am sort of stuck (after reading advise etc) between codeigniter and kohana ...

It appears that codeigniter has really good documentation but still uses OOP on PHP 4... Is this still the case??

So what does this actually mean? I can't use PHP 5 OOP features with codeigniter??

I must admit i was really ready to go with kohana but after doing a bit more investigation it appears that its documentation is very poor..

ZEND FRAMEWORK

Does anyone have any comments with regards to zend framework?

A: 

MVC is excellent, and Kohana is superb. Give it a shot, you'll love it!

I too spent a couple years working with .NET before coming over to PHP/MVC. I tried a couple frameworks prior to Kohana, but grew frustrated with them. Kohana is a very clean and elegant framework, and I've not been displeased a single day with it.

Kohana is an improved version of CodeIgniter.

Jonathan Sampson
THanks, yes it does look liek Hohana is a great product but it doesn't seem to have a good documentation... this worries me a little :-)
mark smith
Kohana has wonderful documentation from my experience. What do you feel is poorly documented?
Jonathan Sampson
+5  A: 

I would say, for a big application, at least, that, yes, MVC is the way to go.


After, which framework should you used... That's another question, which has been debated on SO over and over again ; I'll let you search on the site, about that ;-)

Some great PHP 5 Frameworks, that are suited for big/entreprise-grade applications, are, for instance :

  • symfony
  • Zend Framework
  • You already talked about Kohana -- I've never used it, but many people here seem to know about it ^^

And, about the many man "which framework should I use", you might want to take a look at, for instance :

(Semi-random selection ^^ )


About the IDE :

  • I use Eclipse PDT -- which is some kind of "free version" of Zend Studio ; I like it
  • I know people who work with Zend Studio, and like it too
  • There is also netbeans for PHP, which many people find good too.

I'd say it's mostly a matter of taste, actually ;-)

Pascal MARTIN
I found http://www.phpframeworks.com/ and http://php-frameworks.net/ to be nice links to throw at them too
Gordon
Hi ... thanks i will take a look at symfony an zend framework.. I must admit i love codeignitor ... some good video tutorials... I am using Zend Studio so maybe the zend framework is the obvious choice.... ??
mark smith
Zend Studio doesn't imply Zend Framework : the main common fact is that both are (mainly) developped by a company called Zend -- after that, maybe Zend Framework is better integrated with Zend Studio, but you can use another framework with that IDE ; and another IDE with that Framework.
Pascal MARTIN
Thank you... Do you have comments with regards to zend framework and Codeignitor etc...
mark smith
+3  A: 

I think for beginners CodeIgniter is really great.

It provides a very simple user guide, and good tutorials.

Luca Matteis
Yes i have seen the tutorials and odcs... it seems really solid.. the thing i am confused about now is that its not php 5 or doesn't use OOP from php5 ... It appears that kohana is a better framework but the docs are poor?
mark smith
CodeIgniter does not use OOP internally. You can use OOP for your code.
Milan Babuškov
I thought it did use at least a subset of OOP internally? I suppose it just avoids the better features to be backwards compatible?
Carson Myers
+2  A: 

If you are new to PHP my suggestion is you start with CodeIgniter, Kohana is a fork of CodeIgniter and definitely a much better framework, however, you will learn quicker with the former. Another good framework is CakePHP.

MVC is the WAY to go!

For an editor you can use Eclipse or even Netbeans, there are quite a few out there.

There is no such thing as PURE PHP :)

yannis
Koahana was a fork of Code Igniter but they no longer share the code base, right?
knoopx
@knoopx: Right, according to Wikipedia, Kohana started as a fork of CodeIgniter, but by 2007 Kohana was a 100% rewrite. Probably a good decision to refactor Kohana so it could take full advantage of PHP 5.
Bill Karwin
Pure PHP is good when you work alone. But when you work in team, there is a need for rules, otherwise you'll get code that's very hard to maintain. Frameworks enable you to establish rules easily, simply because you don't have to invent them and explain to each developer that you are "correct". I favor the frameworks that use "convention over configuration" because of this.
Milan Babuškov
@Milan: They are also good if you work alone, is like having a partner assisting you.
yannis
A: 

My recommendation is to use whatever was modeled after/for PHP +5.2. Kohana, Zend Framework, etc... avoid frameworks like CakePHP...

knoopx
so this would also be a NO NO for codeigniter??
mark smith
Probably not, I used it and is nice but I would stick with my previous recommendation. PHP 5.3 is on the corner and finally is fixing major PHP design flaws. All pre-PHP 5.2 frameworks will quickly disappear after this.
knoopx
+7  A: 

There are an overabundance of MVC frameworks for PHP. Most of them are quite good. Which one should you choose? There are numerous questions on StackOverflow that address this.

I'd say it's a toss-up, because most of them support MVC features more or less similarly, and also have some kind of database abstraction. So you can decide based on various non-technical criteria, such as:

  • Software license (GPL, New BSD, PHP, MIT, etc.).
  • Quality of online documentation, tutorials, screencasts.
  • Community activity.
  • Prettiness of their website. :-)

A few of the most popular frameworks include:

  • Kohana
  • Solar
  • Symfony
  • Zend Framework
  • CakePHP (compatible with PHP 4)
  • CodeIgniter (compatible with PHP 4)

And there are a number of PHP content-management systems that are so configurable as to bridge the gap into being a general-purpose framework:

  • Drupal
  • eZ Components
  • Horde
  • Joomla!
  • WordPress

There's no strict definition for what is "pure PHP" but all of the frameworks encourage a separation between PHP code and HTML presentation.

As for editors, I don't use the Zend editor (despite the fact that I worked for Zend at one time) because I don't care for Eclipse. I simply use vim most often, but I have also used NetBeans. See The Best PHP Editor for Vista for a bunch of other options.


update: Re your additional questions: Yes, CodeIgniter and CakePHP are examples of PHP frameworks that maintain compatibility with PHP 4. There were some rudimentary and half-hearted OO features in PHP 4, but PHP 5 really advanced the OO capabilities of the language.

The PHP community has officially discontinued support for PHP 4 as of 2007-12-31, and the last bugfix release for 4.x was 2008-08-07.

So I recommend against using a framework that maintains compatibility with PHP 4, unless you're really constrained to use a hosting provider that is stuck on PHP 4 and won't offer an upgraded environment (though it would be preferable to switch to a different hosting provider if this is the case).


Re Zend Framework: I worked as the project lead on Zend Framework through their 1.0 release in June 2007. In my opinion, they're kind of an "everything including the kitchen sink" framework, and there's little rhyme or reason to their ongoing development.

They were late to support "scaffolding" (i.e. code-generation tools) common to many other frameworks, and the tools they have are buggy and poorly documented.

The Zend Framework project seems to have virtually abandoned all deliberate effort on the database component in the framework, and now they've proposed to replace it with Doctrine, which is a popular ORM for PHP.

ZF's community Proposal process has become stalled, and their roadmap for future development is almost entirely devoted to refactoring their inconsistent internal code and architecture, not value-add features.

Bill Karwin
+1  A: 

You asked for information on Zend Framework

Zend is the PHP company. It is what Asp .Net MVC in PHP. Configuring zend framework takes some time, it is not easy as some others (especially as cakephp or codeigniter).

I use ZF, never wrote a real project with any other, but those who use codeigniter do not say good things about ZF :) (performance matters)

JCasso
+1  A: 

I've discovered Yii a few weeks ago. Seems worth a try. I've used Zend Framework for a while but for various reason i'm investogating others frameworks for future projects.

Sergio
+3  A: 

I upvoted a few answers, but here's another one. I tried CakePHP, CodeIgniter, Kohana, Zend, Akelos and Yii.

From my experience, it is best to start with CodeIgniter, especially if you are not familiar with MVC. It's easiest to learn because of great tutorials, videos and documentation. If you go into some other framework, you would have a hard time learning both how to do something and why it should be done that way. CodeIgniter does both "how" and "why" easily at the same time.

Once you do a few projects with CI (one big project should be enough), you will be more experienced and then you'll see the limitations it has. Then you can select some framework for advanced users. Most frameworks push "convention over configuration" much further than CodeIgniter, so you won't be able to grasp stuff easily until you do a real application and understand what are the requirements. You will also know which features are important to you and what to look for in the next framework you will use. I choose Yii personally, because it fits my needs, but YMMV.

Milan Babuškov
A: 

While there are certainly some great full MVC frameworks available for PHP (CakePHP, Zend, CodeIgniter, etc.), if you want to stick as closely as possible to pure PHP but simply have MVC-like elements of separation between presentation layer, business layer, and controllers, try a simple templating engine like Smarty.

Your MVC folder structure could look like:

  • classes/
    • Model (.php) files.
  • public_html/
    • Controller (.php) files; interacts with Model, passes data to template files and displays them.
  • templates/
    • View (.tpl) files; simple HTML with Smarty tags mixed in. These can be simple variables and can include special loops, etc. Check out Smarty Crash Course.

The benefit of using Smarty is that you keep the benefits of MVC without having the bloat (and learning curve) of a full-blown framework.

philfreo
Explanation of downvote please? His question said "I want to be able to start with PHP and i want to be able to keep as close as possible to PURE php but with a bit more separation" and I believe my answer is a great option for that.
philfreo