
Introducing the new PHP on Heroku - fomb
https://blog.heroku.com/archives/2014/4/29/introducing_the_new_php_on_heroku
======
programminggeek
I think it's cool to have great PHP support on Heroku. PHP doesn't always get
much love from a lot of the developer community, but it has its place and if
nothing else, Heroku support means you can migrate your app there from a
shared Dreamhost account if it ever blows up.

It's good to have options.

~~~
at-fates-hands
>> PHP doesn't always get much love from a lot of the developer community.

This is odd since most people don't think of equating WordPress with PHP, but
WP gets a TON of love from the development community.

~~~
leeoniya
the irony is that WP source and plugin architecture is written in textbook
shit PHP from the 90s. (last i worked with it a couple years ago). i would not
wish WP development onto my worst enemies. i really hope it gets displaced by
something managable written in proper PSR-0 and >=PHP 5.5

in many ways, WP exemplifies PHP core devs' philosophy of "dont ever break
existing ecosystem compat". PHP has some major WTF that lingers on because of
this. i'm very surprised that it has been progressing at all considering how
stubborn they are on even fixing completely obvious shit like "unexpected
comma" errors written in Hebrew. wordpress takes this attitude to a whole new
level :(

there is great, maintainable software written in clean* PHP; the only thing
i've learned from WP is how not to write software.

~~~
jrochkind1
What's your favorite example of great, maintainable open source software
written in clean PHP?

I'd like to look at a good example to give it another chance.

~~~
leeoniya
\- Doctrine - ORM

\- Symfony - framework

\- Silex - micro framework based on symfony components

\- Laravel - framework

\- Slim - framework

\- Swiftmailer - email/transport framework

\- Guzzle - http web service client

\- React - async i/o

\- reactphp/promise - promises

\- AuraPHP - framework components

\- Ratchet - web sockets

\- Assetic - Asset Management for PHP

\- Piwik - Open Source Analytics

\- Monolog - Logging

\- Goutte - a simple PHP Web Scraper

many projects use modular components from these and others.

also check out some repos with a lot of stars
[https://github.com/search?l=PHP&q=stars%3A%3E1&s=stars&type=...](https://github.com/search?l=PHP&q=stars%3A%3E1&s=stars&type=Repositories)

careful though, Wordpress is there also.

~~~
jafaku
You forgot to mention the one that rules them all:

[https://github.com/composer/composer](https://github.com/composer/composer)

~~~
leeoniya
i half-intentionally left it out. not because it's poorly written, but because
its design/architecture may be somewhat lacking.

[http://www.borfast.com/blog/i-hate-php](http://www.borfast.com/blog/i-hate-
php) (see Composer section)

while i have not profiled it myself, i've certainly experienced how slow it
can be with deep dependency graphs stemming from a few, common top level
"require"s. i dont want its slowness to be equated to poor PHP perf in general
or something equally unwarranted.

~~~
jafaku
That article is just more of the usual bullshit used to bash PHP, maybe to
make authors like himself feel better about not using it, and have a good
laugh with other bitter peers. Haters gonna hate.

The author is comparing Composer to Bundler, which makes no sense because
Composer does a lot more than Bundler. With Composer you can do things exactly
the way you want. He says "I don't know what it does under the hood, if it
clones every single repository of every required package independently of it
being necessary", proving that he didn't even bother learning how to use the
tool.

There is no way you can live with Bundler after having used Composer. Trust
me, I was a Rails guy.

~~~
leeoniya
despite the tone, the author does make some valid points. im no php evangelist
myself and find [http://phpsadness.com/](http://phpsadness.com/) quite
objective

~~~
jafaku
Well I only cared about Composer and all his points were wrong.

I'm not here to get into another PHP debate. Non-phpers can waste all their
time hating if they want, and then go fight with all the problems they have
with outdated components like Bundler, create hacks to simulate features that
are native in PHP and other OOP languages (eg: interfaces in ruby, abstract
classes in python), etc. I'll just get things done in a professional manner
using what seems to be the best web platform of our time and then enjoy life.

------
angersock
For anyone looking to get into PHP development now, check out Laravel:

[http://laravel.com/](http://laravel.com/)

It's a Rails-like framework for PHP, and seems to be pretty well designed. I
wouldn't start a new PHP project without it.

~~~
krapp
Laravel is pretty awesome, but in my opinion, I think it borrows too much from
Rails, and it does too much. Just knowing how to use Composer, PSR and a url
router will take care of, like, 80% of PHP's headaches (even though, yes, none
of this is even necessary, it's still _better_.)

The bare metal lack of abstraction in PHP that other languages have to have
but PHP doesn't can be one of its strengths.

~~~
sergiotapia
Ugh the same thing can be said (and has been said - and will be said!) about
Rails, "Use Sinatra", ASP.NET MVC, "Use nancy", Python, "Use flask".

The idea is that Laravel gives you a huge solid launching pad and takes the
busy work out of making a website run.

~~~
krapp
I've got nothing against Laravel (other than Blade, and my own personal
prejudice against ORMs and html generators), I use it and I like it a lot. I'm
just saying a lot of what people seem to hate about PHP can be avoided without
dependencies on much besides Symfony by way of Composer or even a framework at
all - although this depends on how you define "framework."

Which is an interesting question in and of itself - what's the minimum viable
feature set for a modern PHP framework? I would say a PSR autoloader, Composer
and a url router, and everything else is superfluous. Most people wouldn't
even count that as a microframework, and I understand that. And it probably
wouldn't scale for crap either.

Although one thing I _really_ like about laravel, which technically has
nothing to do with laravel, is Artisan. Using .phar files as command line
applications doesn't get as much attention as it should, maybe.

~~~
tmzt
Do you know of any good standalone router libraries that aren't
microframeworks? Specifically, support for placeholder values in URLs but
dispatched through a controller setup, not a Callable for each route.

This would make the ultimate pico framework for PHP.

~~~
krapp
Offhand, no - I have one I wrote myself for prototyping but it basically just
does callables (though it does support placeholders.) Support for controllers
wouldn't be hard to add though.

------
mixedbit
PHP will be a tough market to enter for Heroku. It will be especially hard to
attract owners of small PHP based sites. Almost every traditional, shared
hosting provider supports PHP, prices are really low and setup is trivial
(just dump PHP files in your public_html folder, set DB connection string and
you're done). For larger sites, when scalability and availability become a
significant issue, Heroku platform may be appealing.

~~~
camus2
Well, I dont know. It will all come down to cost,and the ability to manage
CMSs on Heroku, I think.

Something like Wordpress is in my opinion not built for readonly paas,more for
classic/upload with FTP workflow. And Heroku IS expensive while being very
easy to use when one think his app as readonly backed up by cdns and
databases.

I deployed a few Symfony projects on Heroku,it works well. But why choose PHP
when I can choose my entire stack since not limited by host restrictions?

It's an interesting experiment nevertheless.

~~~
waxzce
In fact it's exactly why we create FS bucket in the Clever Cloud product :
[http://doc.clever-cloud.com/databases-and-services/fs-
bucket...](http://doc.clever-cloud.com/databases-and-services/fs-buckets/)

~~~
camus2
Nice,Fellow french,here,i definetly need to check out your paas!

~~~
waxzce
:-)

------
alttab
Is this a strategy to increase the market potential of Heroku? It was mainly
meant for "super fast rails" development and deployment, so I'm wondering why
Heroku is targeting PHP.

Some would say its part of their "all platforms" deal, but then I'd argue its
not much different than AWS. I'm wondering if they can bring some of the large
portion of PHP websites that still run today onto their platform as a way to
increase active and paying users.

~~~
thinkbohemian
Heroku employee here. I'm curious about this statement:

> I'd argue its not much different than AWS.

Could you expand here? What about the platform do you find similar and
different? Which of that is good and bad? What were you using each to
accomplish?

I'm happy to answer questions about Heroku. But I do like hearing unfiltered
impressions and experiences before I taint them with my own world views.

~~~
alttab
The value proposition on the front page is "Build, run, and scale apps."
Arguably, AWS does this and much more. AWS doesn't really make decisions on
what technology you use, so if you wanted to run PHP on AWS it wouldn't take
additional effort on Amazon's part.

Heroku probably does some nice workflow things, which is a feature, not a
product. Whatever "timesavings" the tooling provides is an AWS feature release
away from having parity.

Personally, I've only tested Heroku a couple of years ago out of curiosity.

So here is Heroku, working closely with facebook to bring the PHP platform to
Heroku, while all along other hosting and infrastructure companies don't even
have to worry about supporting PHP because they sell you scaled box-space, not
application stacks.

I guess my whole point is "if you're building your apps with PHP these days,
you are probably the type of shop that would benefit from the value-add of
Heroku." That is, small to medium businesses with 1-2 web guys running a PHP
app who don't know shit about hosting, deployment, or scaling.

Does that make sense?

~~~
thinkbohemian
We've had huge buy-in from Ruby as it's pretty difficult to set up and deploy
a Ruby stack. Where as with PHP it's basically supported out of the box by
pretty much everyone.

It's hard to sell Heroku which is why we have the free trial dynos. I find
most people either love us see us as a huge value add, or don't understand why
anyone would use us.

We're not simply a small abstraction layer, instead we support deployment at
the application layer. Which again basically sounds like meaningless fluff
unless you've already bought into the product. If I had to sum it up, i would
say we're a company that provides a collection of small, sharp, extremely well
integrated tools that seek to make your production development experience more
pleasant.

For Ruby you get the app setup which is huge, but then you also get process
monitoring out of the box so if your app goes down due to hardware failure we
get paged at 3am instead of you. It's extremely easy to do things like have
multiple staging servers, and I really like our CLI.

Instead of trying Heroku, I would recommend starting off trying out Heroku
Postgres and using it through whatever server you deploy to right now. Get the
credentials from the CLI.

On a production DB you get forks, and followers. We also have point in time
recovery which is pretty fancy. Hacker destroy your DB? Forgot to schedule a
backup? Rollback to 1 second before the deletions, and done. If you like
Heroku Postgres, then I would recommend trying the dynos, and if not: agree to
disagree.

For PHP the sell is management, stability, and consistency. If you're on a
shared host your performance is very inconsistent as well as your uptime. If
you're on a VPS you have pretty decent performance but now you have to manage
everything manually, and even then there's that uptime thing we're not 5
nine's but hopefully above most:
[https://status.heroku.com/uptime](https://status.heroku.com/uptime).

I honestly don't think we're right for every application, every developer, and
every scenario. When we are though I hope to provide the best experience
possible.

~~~
alttab
Right. OK so I had it placed correctly. Heroku is for guys that are not
experienced in hosting, deployment, operations, or scaling. And that's a lot
of small guys.

Where your customers get bitten is when their needs outgrow you, and it
happens in weird ways (routing performance, multiple database types, scaling
profile, management tools), and its different for each customer.

And you've nailed it as far as your target audience. So really, supporting
extra bells and whistles for PHP is a way to capture more of that market - the
small to medium shop run by a couple of dudes who have some shared host PHP
app knowledge.

So, Heroku's value is really in its add-on services, not its hosting, or its
scaling. PHP shops feed your every day hosting provider, so if Heroku can
consolidate that market its a big win for Heroku. The taste in my mouth is
this was spun as innovation when its not.

------
craigkerstiens
Here's another post as well in relation to our support where we look back at
where PHP comes from, but also where it's heading -
[https://blog.heroku.com/archives/2014/4/29/php_a_look_back_a...](https://blog.heroku.com/archives/2014/4/29/php_a_look_back_a_look_forward)

~~~
aram
Speaking about where PHP is heading, I think it's pretty important to mention
the funding Fabien Potencier managed to get for SensioLabs (company behind
Symfony):

[http://fabien.potencier.org/article/71/sensiolabs-
raises-5-m...](http://fabien.potencier.org/article/71/sensiolabs-
raises-5-million-euros-to-boost-the-symfony-ecosystem)

I haven't seen any mention of that on HN.

Symfony components are used in Laravel and upcoming Drupal 8. The funding
above means that SensioLabs will continue to work on solid platform(s) that
will bring higher quality development and standards to PHP.

Honestly, I'm pretty happy for that.

~~~
adamors
Symfony is the best thing to happen to PHP in a long time and the guys at
SensioLabs are doing a lot of great things. It wasn't on HN because HN still
thinks PHP equals Wordpress/Drupal and those codebases are horrible.

~~~
jcroll
Which is unfortunate. Symfony + Composer is powerful elegant (yes _elegant_ )
stuff.

~~~
adamors
It is unfortunate indeed, because it's not just the software that is great,
but the surrounding community as well who create a lot of great tools like
phpSpec, Behat etc.

------
franklaemmer
plug: i'm co-founder of PHP-only-PaaS fortrabbit — seeing Heroku move in our
direction shows me that we are doing something right. We see a lot of momentum
in the PHP community — some call it a PHP renaissance. Laravel, Composer and
lately Facebooks input with HHVM (& Hack) are the cornerstones. Of course PHP
is not everyones cup of tea, but something to be taken seriously.

------
martin_
This isn't "the new PHP", and I hope it is amended. Facebook making their own
runtime by no means makes it newer than the official version produced by the
PHP contributors/zend team until (if ever) it makes it into the core.

~~~
_zen
Don't read it so literally. They're just saying it's the newest PHP tech at
Heroku. New as in "hip", "latest", "trendy", etc..

~~~
KMag
In other words, a more charitable parsing would be "the new (PHP on Heroku)"
instead of "(the new PHP) on Heroku".

------
wambotron
I used Heroku for hosting my php site ([http://sea-hag.net](http://sea-
hag.net)) for a while on the free tier. It was OK, but the DB add-ons were all
pretty terrible (even on the lower pay tiers). In the end, I ended up getting
a VPS and hosting it on that. Now it's lightning fast and I can't complain.

Heroku held its own for a while. I'd recommend it if you need to do some quick
testing and get people on it to start, but I wouldn't pay for it.

------
jacobbijani
It's great for quickly hosting a static site on Heroku. Just name your HTML
file index.php!

------
vinhboy
Cool. Just in time for the end of free AppFog.

~~~
JoshGlazebrook
You mean the "free forever" AppFog tier that still had that "forever" promise
a year ago? They sure have gone downhill since being bought by CenturyLink.

~~~
eli
Nothing is forever, just ask the suckers who still had stuff hosted at
Textdrive (like me)

------
aram
Can't get over the way first sentence sounds:

> PHP developers are makers at heart.

What is the difference between a PHP developer and any other developer? If
they tried to stick this in the middle, I could swallow it but opening
sentence is just ridiculous.

~~~
thinkbohemian
Hello, I helped edit the blog post and actually proposed this sentence. I love
this reaction:

> What is the difference between a PHP developer and any other developer?

It's exactly the type of response I was hoping for. In early drafts we got a
common "big whup" response from some readers. Most posts on PHP these days
only do well when they bash the language, very few focus on __why__ they use
PHP: which is to create things. Yes, all developers create things, and PHP
developers do as well. This sentence serves to validate PHP and their
developers. So to answer your question:

> What is the difference between a PHP developer and any other developer?

Nothing.

Even if you still don't buy my explanation. Maybe you can stomach some non-
wordsmithed docs: [https://devcenter.heroku.com/articles/getting-started-
with-p...](https://devcenter.heroku.com/articles/getting-started-with-php)

~~~
aram
I still don't buy it. I find that type of sugarcoating generally unnecessary
and distracting in negative sense, especially when you start the announcement
with it.

Either way - thanks for taking the time to explain.

~~~
thinkbohemian
No worries. I start a lot of writing with a "hook" first sentence and try to
end with a memorable sentence. I then diagram the work into bullet points and
try to make sure all key takeaways are obvious, note I didn't actually work on
the _final_ draft of this doc. I was pleasantly surprised to find they left my
first sentence in there.

Some hooks are better than others. I'm an engineer before a writer. It sucks
that we have to market tech things, but the sad truth is most announcements
that have no "hype" get no hype. I do a bunch of open source work, and some
projects I promote and they do well, others I don't promote and they don't do
as well.

Generally at Heroku I try to only put one or two flashy sentences in. The rest
should be direct substance delivery, though that's not always the case. Thanks
for taking the time to click the link, read, and comment!

