Live data from Hacker News

The Lesser Known Contributors Who Are Trying To Make PHP Good Again

danielnill.com

11–20 of 53 posts

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#11
post #9

Everyone probably knows this, but PHP's Smarty template engine ( http://www.smarty.net ) is really awesome. I've yet to see a better one in any language - it has things like Unix-like pipe chaining of filters, user defined functions, and intelligent caching built in. I reduced the number of lines in one codebase I worked on by 70% through use of Smarty.

[deleted]

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#12
post #10

While I've bashed PHP as much next guy, these are the facts: -Take away PHP and the internet would break. The vast majority of websites are either written in PHP or have a PHP back end. -The LAMP/LNMP stack is by far one of the most deployed web server configuration. -PHP is extremely well documented and it's been around so long that it's easy to find solutions on the web. PHP is the Model T of web languages: people…

The documentation point is important - it's been used in so many projects that a lot of weird fringe cases occurring in only the most bizarre setups have been documented. There is a lot of value in that, and it takes time to build a similar body of knowledge for newer platforms.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#13
post #9

Everyone probably knows this, but PHP's Smarty template engine ( http://www.smarty.net ) is really awesome. I've yet to see a better one in any language - it has things like Unix-like pipe chaining of filters, user defined functions, and intelligent caching built in. I reduced the number of lines in one codebase I worked on by 70% through use of Smarty.

I enjoy using Hiccup more than any template engine I've used previously. Before I met (Clojure and) Hiccup[1], I would have said the same regarding Coffeekup[2].

But what's really amazing is when you combine Hiccup with Enlive[3]. Enlive can give you a headache when you first start working with it, but then there's an almost magical "aha!" moment, and not long after that you'll never want to look back. By "combine" I mean using Hiccup and metadata from your db (or whatever) to generate empty, logic-less views and then using Enlive to bind in your data.

Combine those steps with your own macros and HOFs, look for some choice places to memoize function calls, and now you're cooking with gas.

[1] https://github.com/weavejester/hiccup

[2] https://github.com/mauricemach/coffeekup

[3] https://github.com/cgrand/enlive

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#15

Earlier quoted context omitted.

Perl fans would probably object strongly to that, but it is true that when PHP first caught on there really weren't any great choices.

The strong selling point of PHP for a long time was cheap hosting. Combine that with a fast learning curve and you're set. Nowadays, it's not so clear cut price wise, but PHP took a strong advance in term of user base - look at the number of libraries, projects, and jobs (!) available in PHP, vs python or ruby.

good selling points, but those things never made it a good language, it was just convenient.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#16
PHP was never good, but it abstracted away some basic web specifics -- as opposed to CGI/Perl that required you to care about protocol details such as starting output with two newlines -- and hit a sweet spot infrastructurewise -- dead easy to get started with, dead easy to get hosted for next to nothing -- that gave it enough traction to grow very quickly.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#17
post #9

Everyone probably knows this, but PHP's Smarty template engine ( http://www.smarty.net ) is really awesome. I've yet to see a better one in any language - it has things like Unix-like pipe chaining of filters, user defined functions, and intelligent caching built in. I reduced the number of lines in one codebase I worked on by 70% through use of Smarty.

I work on a legacy code base with pretty much everything in SMARTY templates (including CSS and JS files!) and it's really aweful. It may not be SMARTY's fault, but most of what's going on could be just as easily done with PHP code than with SMARTY tags, include variable insertion () and control logic (if ($var) : // endif;).

Now we've actually moved everything to the client side using Ember and Handlebars templates. JS doesn't have any built-in templating like PHP (which is basically just a template engine), so Handlebars makes it really useful to write up HTML code blocks that get variable insertion and data-binding on the client side.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#18
post #10

While I've bashed PHP as much next guy, these are the facts: -Take away PHP and the internet would break. The vast majority of websites are either written in PHP or have a PHP back end. -The LAMP/LNMP stack is by far one of the most deployed web server configuration. -PHP is extremely well documented and it's been around so long that it's easy to find solutions on the web. PHP is the Model T of web languages: people…

I don't know enough to deeply critique the various web languages, but if PHP is the Model T, wouldn't it sound odd and backwards facing to talk about reviving and improving it?

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#19
post #9

Everyone probably knows this, but PHP's Smarty template engine ( http://www.smarty.net ) is really awesome. I've yet to see a better one in any language - it has things like Unix-like pipe chaining of filters, user defined functions, and intelligent caching built in. I reduced the number of lines in one codebase I worked on by 70% through use of Smarty.

PHP is itself a template engine.

Bolting a template engine on top of that makes no sense whatsoever.

Re: The Lesser Known Contributors Who Are Trying To Make PHP Good Again

#20
post #2

When was PHP good in the past? (Honest question; I don't use PHP.)

When shared hosting was the norm. mod_php was much faster than CGI and a lot safer to use because usually processes in one virtual host did not affect processes in another unlike with mod_perl and the like.
Post reply on HN