Live data from Hacker News

Ask HN: Still acceptable to use PHP for new projects?

news.ycombinator.com

1–10 of 23 posts

Ask HN: Still acceptable to use PHP for new projects?

#1
We've all heard the discussion of PHP over the years- its faults, why other languages are better. However, it is the language & ecosystem that I know best and have the most experience with.

Obviously, the user doesn't care about the backend of a system. From a developer's point of view, though, is PHP still acceptable to use for new projects, even though "better" languages like Python and Ruby are way more available than they were years ago? Or is it no longer considered a good idea to use PHP if I'm starting with a clean slate?

Re: Ask HN: Still acceptable to use PHP for new projects?

#4
On one hand, you should use the tool that you know best.

On the other hand, putting the language itself aside, dev-tools and existing libraries are few-and-far in between (and they usually suck). And when I say libraries, I don't mean snippets on the internet.. true libraries with tests, etc. Besides the frameworks and a handful of active packages on PEAR- good luck.

There is a reason why Ruby and Node have awesome tools (gem, npm, webrick, jasmine, cucumber, etc. etc.) and a very active library sharing mentality.

Re: Ask HN: Still acceptable to use PHP for new projects?

#6
Dont let the HN Hivemind fool you, plenty of people still use PHP and write beautiful, OO code.

The language you use doesnt determine whether you're a good developer or not. I have used other languages (node, python, ruby) and I still prefer php, because its quick and simple. Its syntax may not be as beautiful as a python or a ruby, but it php just works, and it powers hundreds of millions of sites.

Bottom line, use what your comfortable with, but be open to exploring other languages. Dont ever let someone tell you a language is better than x. Make those decisions yourself.

Re: Ask HN: Still acceptable to use PHP for new projects?

#7
There are pros/cons to any language. If you're developing something web related, PHP is certainly worth considering (especially in your case, as you have experience with it).

Just a few quick thoughts:

PHP is - in most cases - very tightly coupled to the HTTP request. This can be good or bad depending on what you're building. Doing a lot of offline processing? Probably bad. Serving up web pages? Probably good.

There's no (or little) state with PHP (you do have the session, which can be pushed to memcache), so - generally speaking - running your application across a bunch of web nodes isn't too hard to implement (even scaling the horrible legacy style code that helps give PHP a bad reputation shouldn't be too hard). This may or may not be important to you.

There's really no one true way with PHP - it can be used for a simple 10 line script, or for a large scale web application. If you like (or need) that kind of flexibility, it could be a good choice.

Bottom line is - it's certainly sill worth considering, just know why you picked it (or whatever other language/platform you use).

That said "it's what I know" or "I wanted to try something new" aren't necessarily bad reasons.

Re: Ask HN: Still acceptable to use PHP for new projects?

#8
is PHP acceptable? well, obviously it depends on the project requirements, for instance programming a chat server in PHP is probably not the best choice, but even though PHP has its faults for me it remains a solid language for building new web applications. Here's why:

1. Its easy to scale (horizontaly) because it has a "share nothing" archtecture.

2. like tjlyte states its centered on the HTTP protocol which is almost always your app protocol

3. its fast

4. its an "easy" language to program, but still supports OOP, namespaces, closures, anonymous funcs, etc.

5. Its highly portable

6. It has a very extensive developer base, tons of libraries and frameworks that are starting to reach enterprise Java level maturity (Flow3, Symfony2 for example )

Re: Ask HN: Still acceptable to use PHP for new projects?

#9

On one hand, you should use the tool that you know best. On the other hand, putting the language itself aside, dev-tools and existing libraries are few-and-far in between (and they usually suck). And when I say libraries, I don't mean snippets on the internet.. true libraries with tests, etc. Besides the frameworks and a handful of active packages on PEAR- good luck. There is a reason why Ruby and Node have awesome t…

I think your statements about lack of libraries for PHP would have been correct about 4 years ago - maybe even as late as 2010 (pre namespacing in PHP). But as of date, I don't think they hold up. The Bundle concept implemented by Symfony2 - and being adopted by others, has really caused a boom in solid high end libraries that can easily be integrated with any project. ( check out: http://knpbundles.com/ )

Re: Ask HN: Still acceptable to use PHP for new projects?

#10
post #7

There are pros/cons to any language. If you're developing something web related, PHP is certainly worth considering (especially in your case, as you have experience with it). Just a few quick thoughts: PHP is - in most cases - very tightly coupled to the HTTP request. This can be good or bad depending on what you're building. Doing a lot of offline processing? Probably bad. Serving up web pages? Probably good. There'…

Good points. I feel I should point out that you can use PHP independent of any web server by using the command line interpreter (CLI) version. This is, for example, how we run PHP cron jobs where I work.
Post reply on HN