Every few months, PHP gets a major bashing from developers who prefer other languages. These jeers are often from those who treat PHP like the runt of the litter; mainly because they’ve not used it in a decade and think it’s still PHP 5.2. Alternatively, they often make fun of it because they switched to some other language and noticed it has some cool stuff.
All of those jeers – as unproductive and annoying as they are – have an element of truth to them. PHP does have plenty of faults, and other languages do have plenty of awesome things. Those other languages have plenty of faults too, and are also often missing a lot of things, but folks who use the same language most of the time grow used to its faults, and don’t notice what they’re missing.
In general, only knowing one programming language blows. It’s certainly ok and absolutely recommended to start out just learning the one, as you don’t want overload yourself learning everything at once. When you’ve got a foothold with one programming language, you should try to start picking up other languages, even if you are only dabbling with them.
I spent a decade only writing PHP before branching out into using Rails, and later ended up doing a few projects in Python and Go. When I was starting out, learning other languages seemed really hard, and in the early 2000s it was all thick books, and trial & error. Now there are educational videos and quizzes, from sites like CodeAcadamy, Treehouse, Teachable, Pluralsight, etc., which make this easier than ever before.
Learning multiple languages widens your career opportunities, makes it easier to work in a service-orientated architecture where things might not all be PHP, and helps you make sure you’re using the right tool for the job, instead of just hammering every nail with the double-claw.
One great benefit of learning multiple languages, is that you get to see how things work in other communities. Most of the time it’s not even the language itself, but the ecosystem. Sure Go has a more consistent standard library, and Ruby has a pile of lovely syntactic sugar, but what really gets my attention is the tooling other languages have.
After a fair chunk of Rails experience, I helped bring back some of the features I liked into FuelPHP and CodeIgniter. Since then those two projects have fallen by the wayside, but all of the Rails-based features that went into FuelPHP seemed to find their way into Laravel, meaning PHP had benefited greatly from Rails. Taylor Otwell himself having a strong background in ASP.NET meant some of his ideas for Laravel were fresh and different to the norm in PHP, which again, benefited PHP.
Since I started playing with Rails back in 2010, a lot of other things I liked from that framework found there way into PHP in some form. I took ideas from OmniAuth and made NinjAuth, but sadly that was FuelPHP-only and is no more. I took some ideas from their oauth 1 and 2 clients, and brought them over, but again they were FuelPHP only.
The framework specific thing got a bit annoying, so some friends and I started up The League of Extraordinary Packages, a place where these packages ideas could come, with no ties to any frameworks. A place where folks could bring new and interesting ideas, get some traction, share the responsibilities of maintenance with others, and never get stuck in a situation where they were begrudgingly looking after code they no longer used.
- Fractal – the equivalent of ActiveModel::Serializer or Roar in Ruby.
- Faker – heavily inspired by Perl’s Data::Faker, and by Ruby’s Faker.
- Factory Muffin is Factory Girl
- Flysystem is quite likely inspired by Fog (I never did ask Frank about that)
Other tools have been ported to PHP by other awesome developers:
- Behat is Cucumber
- PHPUnit is an implementation of xUnit inspired by JUnit
- Kahlan is basically RSpec
- StackPHP was inspired by Rack
- PSR-7 and middleware takes a lot from StackPHP/Rack/and NodeJS’ ExpressJS
- PHP-VCR is an attempt to bring Ruby’s VCR into PHP
- vlucas/phpdotenv and josegonzalez/php-dotenv are ports of dotenv
- php-resque is a port of resque
- The list goes on
The PHP community is made stronger by those who use more than just PHP. Folks who take the time to learn multiple languages can share the fruits of their knowledge with everyone, and build some really interesting stuff.
Not only that, but having experience with other languages can really help get you through those awkward “oh you’re a PHP developer?” snarky runnings. We’ve all been there; You mention at a non-PHP conference the tool you use, and folks judge you harshly and immediately. Well, one side benefit of knowing more languages, is that folks generally assume you’re smarter if you know more than “just PHP”.
The amount of times I’d say “PHP” and they’d start being patronizing, then I’d say “Oh I use the best tool for the job, and in many scenarios that’s been PHP. I often write distributed software, and PHP has the largest potential install-base. Of course I’ve plenty of experience with Go, Python, Node and Rails too.” They’ll usually change their tone substantially, but if they keep it up, follow with: “Do you mind if I ask, what’s your issue with PHP? Have you used PHP 7 at all or were you back on PHP 5 something?” Watch as they shrink back when they realize you’re not a fool.
Learning from the progress of other communities is always helpful, for yourself, and for the communities you consider yourself part of. Even if you don’t think of any awesome packages that PHP is needing, learning other languages will generally improve how you write PHP anyway.
So, go learn a another language, and make PHP better while you’re at it.