9

I have been dabbling in programming/scripting languages since I was a kid. I started off with HTML and CSS, then went on to PHP (which I got quite good at) and then to Python, Perl, and C(++). I've recently done a lot of work in PHP (along with MySQL).

After spending so much time learning these languages, I now want to do something with them. I'm looking at starting/contributing to an open source project; almost certainly a web application of some sort.

In my experience with writing (admittedly small) web applications, I've found writing "pure" PHP to be an extremely slow and tedious process.

My question is this: if I were to be writing a relatively complex/large web application from scratch, what should I write it in? Should I use pure PHP/MySQL, or use a framework like Django, Rails, or CakePHP?

Tim Barnaski
  • 51
  • 1
  • 1
  • 4
  • Dont use PHP. (http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/) You will find that you spend most time doing Frontend Stuff in HTML+CSS+JS and the proper templating. Using PHP for the Controller Part is just a bad choice. Try flask+Jinja2+Bootstrap or something while separating the logic from the presentation. The world does not need more PHP programmers. But yes - Framework, but not without properly understanding what it does. – sleeplessnerd Jan 30 '13 at 18:58

4 Answers4

14

Writing a complex application from scratch, I would definitly not use "bare PHP" : I would certainly use a framework : they provide :

  • a large number of useful classes/methods
  • some set of rules -- like "in which directory should controllers be saved", "how to write a view", ...
  • MVC -- i.e. they help with better structuration of the project

Note that this answer is valid for both personnal projects, and professionnal projects.


There are several great Frameworks in PHP, like :

One thing to remember : learning how to use a framework well will take some time : starting with a small project, before going for a big one, would probably be a good idea ;-)


Now, when you're asking yourself the question of "which framework should I choose", it's mostly a matter of personnal preferences... And here are a couple of questions/answers that might help a bit :


As you're asking me which Framework I would choose ; well :

  • I really like Zend Framework, and often use Doctrine as ORM (it's the default ORM of Symfony, but can be used very easily with ZF)
  • If I had to choose another one, I would probably go with Symfony, as I've seen it used on a couple of projects at work, and know many people who work with it and like it
Community
  • 1
  • 1
Pascal MARTIN
  • 395,085
  • 80
  • 655
  • 663
  • I'm not necessarily after a PHP framework; I've looked at Rails and Django, though not in great detail. – Tim Barnaski Mar 06 '10 at 21:27
  • @Tim : I've edited my answer to add some informations, and answer you question :-) *(Sorry, I cannot say anything about ruby nor python : never worked with those languages)* – Pascal MARTIN Mar 06 '10 at 21:29
2

If you already know that language, you should most definitely use a framework (unless you're a masochist).

For me, besides that fact that they're usually bundled with all sorts of great libraries, using a framework is all about using time effectively.

Most importantly, it will save you time. You're freed from the nitty-gritty of worrying about the foundation/architecture and are able to spend your time of the features of the application itself.

Also, it will save others time; especially since you plan on being all open sourcey.

Justin Johnson
  • 30,978
  • 7
  • 65
  • 89
  • Unless you're trying to learn a language reinventing the wheel is not a good use of your time; unless, of course, you think you can make a better wheel (then more power to you). – Justin Johnson Mar 07 '10 at 01:46
1

depending of your skills level, yes you can do it in pure PHP without frameworks. This also will be good, IMO, to improve your skills at debugging, logics, and others. But, on the other hand, you will restrict to other programmers to improve/maintain your code due to learning curve, in this case, the framework serves as a commom language. I recommend that if your project will be complex, or with the possiblity to other programmers join in the project, that you choose a framework which you feels comfortable and use it.

Daniel Loureiro
  • 4,595
  • 34
  • 48
0

Depends on who will be working with the code, on which plattform it has to run and how complex the database should be.

If you develop for a company or community it is always easiest to use PHP because there are many others who know it so i.e. for companies it's easier to recruit someone who knows the language.

If you mostly want to develop on your own, use what you like most, i even heard of websites written in pure common lisp.

If the application can run on windows only C# is also a good solution as you can develop web applications extremely fast and the .NET library makes many tasks easy.

As database backend you can use MySQL if the structure is simple but for more complex databases i'd use postgres as the MySQL performance seems to drop fast with increasing complexity (subjective opinion).

EDIT: As others noted, Frameworks are always a good idea. There are web frameworks for most of the current languages. For PHP CakePHP was recently recommended to me.