Cover image by Camilo Sanches, CC BY-3.0, via Wikimedia Commons
I was working on a meetup for serverless developers recently and an attendee mentioned the Symfony PHP framework, and how there was actually a runtime to run PHP serverlessly on AWS!
Pretty impressive stuff, but I'm curious to hear from the up-and-coming readers of DEV: are you still using PHP? If so, what do you use it for?
Are you using it because you're stuck with the framework at your place of work, or are there things you love about it?
note: My DEV articles are not places to make fun of other developer's skills. Any dismissive or derogatory comments will be deleted and the posting account reported.
Top comments (50)
PHP powers 80% of the websites on the internet. Of course, there are tons of PHP developers, including me. It is a beautiful language IMO, has its quirks but it is good. There are literally million dollar businesses running using PHP and I suppose that's why I'm sticking to it.
I'm a front-end web dev in a digital agency and we were thinking to switch to Javascript both for the front and the back end. Then taught about it and decided to keep PHP for the backend and in case use Javascript (react, angular, vue) only for the frontend. So yes, PHP is still a big player for us ☺️
Just curious -- what made you guys stick with PHP on the backend?
There are several factors:
Just my point of view ;)
I've been using PHP for perhaps the past 12 years or so? To start with I used it out of need, agencies were using PHP systems (Wordpress, Joomla, Magento) and then moved to companies that has pre existing products built in a variety of frameworks.
But after spending the last 12 years as a PHP developer, learning other languages along the way such as python, objective C, swift, Ruby, GoLang etc - I still reach for PHP when I'm building for the web. Why? Because it works, it's fast to do things in, and it's a lot better than people remember. We aren't in PHP 4 or 5 days anymore, we have a mature OOP approach and a fantastic ecosystem for packages and distribution, PHP 8 alone introduced my absolutely incredible features and speed improvements.
With all of the above being said, when it comes to serverless tech, where I am paying per 100millisecinds a program is running - I would lean away from PHP. It's great don't get me wrong, but it's not as fast as something like GoLang. I've built massive warehouse and distribution systems in serverless Go Lang and while it takes longer it's worth the time investment. If I'd built these systems in serverless PHP, the billing would escalate, as PHP takes longer, q simple fact. This is coming from a PHP advocate.
PHP does not belong in a serverless environment in my eyes, unless we are talking about a dockerized environment that runs when required such as Google Cloud Run - but lambda, no.
PHP is web, it's great at web, it's reliable and works well at web, it's not optimized for anything other than web interactions (apart from handy small CLI apps).
Just because you can do something doesn't mean you should do it. You choose the language that works for you, and works for your requirements, if that is PHP great if it isn't PHP that's fine also.
My first programming language is PHP. The Learning process is amazing and easy to learn currently I'm working on Laravel framework. I'm absolutely loved it
I've heard good things!
You'll heard more....
Yes mate! Many ~ administration panel, backend services and stuff. Although I prefer another lang now, but PHP are okay though. With cloud nowadays you can achieve scalability with PHP too!!
I really recommend PHP to beginners, it is easy to get job with PHP than golang or rust.
I still reach for PHP when I don't want to give another 1GB+ for node_modules.
PHP is good at processing HTML and XML: the SimpleXML module is powerful.
If I want non-HTTP application, it's either Node.js (versatile) or Go (fast).
If you used a process manager then it would have to be running in the background to speed up the bootloading time, which would make it not serverless.
Don't get me wrong, I am a huge advocate for PHP, but I'm also a huge advocate for using the right tool for the job.
The main problem with using roadrunner like this is that you loose the point of serverless, however what it does give you is a fantastic way to add the next level of performance on a PHP server.
There are situations where serverless makes a lot of sense, but not all problems can be solved with serverless. I prefer to take the approach of progressive enhancement with serverless, and it's worked well for me in the past.
1) thank you for having such a respectful conversation in the comments!
2) i think on the face of it, yeah, Serverless isn't a perfect home for php since it's explicit purpose is to construct full web responses.
But there are situations where it will make sense for your team to use a Serverless platform for PHP. the users of Symfony Serverless *love" it and clearly paying for loading/startup isn't significant enough to sour them.
If your team has high Serverless expertise and a particular task runs efficiently on a Serverless platform, it'll make more sense to use it than making your team learn Go.
I completely agree, the main driver for a lot of the decisions in a team is a split of cost/effectiveness against team skill/knowledge/expertise. You need to make sure most of all that what your building is the best you can do, even if it isn't the perfect way, it's better than using tech you don't know in a language you have a basic understanding of.
RE: respectful conversation: no need to thank me, it's what we should all be trying to do! Yes we all see a long of comments and conversations saying PHP is dead or isn't very good etc etc; but instead of jumping the gun and going on the defensive, it's easier and better to try to educate people on your experience with X language or framework. Also, respect costs nothing
Thank you so much for your posts here Steve! You mentioned several topics which I have no knowledge about yet, and described them honestly, openly and respectfully (something which we need more and more nowadays).
Truly appreciate your comments.
You're more than welcome, please feel free to reach out if you need advice on any of the topics I've mentioned ☺️
I work in a big company and PHP is our main language by far, with a bit of Python for data-heavy backend processes a some Vue for frontend.
PHP is so easy to setup and deploy, lightweight (unless you use laravel or something like that), flexible and so dead easy to learn and debug that I haven't found yet any really compelling reason to switch to something else.
With PHP 8.1 the language will become self serving with parallelization, like Node, albeit you can do that with Swoole already.
For us it works perfectly fine for our heavy-duty mobile API.
Even after using it for 20 years I still use it on day to day basis.
Reason being the same that everything that was coded in PHP has to be maintained and managed in PHP.
I still create new things in PHP and that is because it feels familiar and I don't have to change mental gears. Ultimately in most of the cases what matters is the HTML output of the project. If that is covered with ease of management and rapid development speed (My personal rapid development speed, due to not changing mental gears) then why bother with something else.
Yeah, each version of PHP is getting better and better and there was no reason for us to really switch to anything else at that point of time.