News for hackers. Stuff that matters.
Re:A bank runs serverless with PHP and AWS Lambda by mikece on Wednesday November 01, 2023 @11:17AM (#38099381)
I don't know which surprises me more: that they continued to use PHP in their move to serverless/microservices or that nobody else on HN has questioned this point yet. I totally get why they would keep PHP: they have the language/platform experience already and AWS supports it (which is really more than enough to silence the "You should have switched to {other_language}!" partisans). Plus, I imaging non-trivial amounts of copy & paste of proven functions was key to moving from monolith to Lambdas... why change the code if it works?
Re:A bank runs serverless with PHP and AWS Lambda by mikece on Wednesday November 01, 2023 @11:32AM (#38099648)
Did I get voted down because I actually agreed with keeping PHP rather than changing languages? I don't care about the karma points, just curious if someone thought I was attacking PHP because they didn't read the whole comment.
Re:A bank runs serverless with PHP and AWS Lambda by mjburgess on Wednesday November 01, 2023 @11:45AM (#38099847)
it would be nice if HN had a random "explain your vote" mode where voters had to choose from, eg., agree, helpful, insightful, etc. vs. disagree, unhelpful, provocative
Re:A bank runs serverless with PHP and AWS Lambda by mikece on Wednesday November 01, 2023 @11:47AM (#38099895)
I will admit that I've made trolling comments from time to time which get well-deserved vote-downs, but there are certainly times where I would like to know what the point of disagreement is because if I'm missing a point of view from which I could learn I would like to know!
Re:A bank runs serverless with PHP and AWS Lambda by solardev on Wednesday November 01, 2023 @12:44PM (#38100973)
If only there was some other famous tech forum with a descriptive voting system that we could learn from...

(https://slashdot.org/faq/mod-metamod.shtml)

Re:A bank runs serverless with PHP and AWS Lambda by yaseer on Wednesday November 01, 2023 @11:24AM (#38099501)
I'm wondering if PHP's reputation has been rehabilitated somewhat in recent years. At least amongst those who understand the significant changes in modern PHP, and the difference a stable framework like Laravel makes.

I've found PHP with Laravel a stable and solid workhorse. Good for getting things done quickly, and then a stable system over time.

In contrast, I've gradually become disillusioned with the node.js and JavaScript/TypeScript ecosystem over the years. You can build quickly, but the systems turns into a pain to maintain and update.

Re:A bank runs serverless with PHP and AWS Lambda by kypro on Wednesday November 01, 2023 @03:42PM (#38103812)
It genuinely amazes me that Node is as popular as it is, especially within large mission critical businesses. If this bank was using TypeScript no one would have questioned it, but you're right, TypeScript is a nightmare to maintain. I probably only use about half of packages I used 5 years ago because either those packages are no longer maintained or the community has switched to some other package that basically does the same thing just in a slightly different way. There's also no real industry standard ways to do anything in Node. You find 10 different Node CRUD projects and they'll all do things completely differently.

The PHP ecosystem on the other hand tends to be less fragmented and these days with frameworks like Laravel the code is generally also pretty good. I think it gets a bad reputation because in the 00s there were some truly horrific PHP projects out there and the language itself was quite immature and poorly designed. That's not the case anymore though. These days I struggle to understand the hate it gets. It's certainly no worse than than Node.

Re:A bank runs serverless with PHP and AWS Lambda by stronglikedan on Wednesday November 01, 2023 @11:31AM (#38099638)
Perhaps we're finally at a point on HN where people realize there's no need to question the use of PHP. it's a robust, capable language that's just as, or more, suitable for the majority of use cases as any other language.
Re:A bank runs serverless with PHP and AWS Lambda by zelon88 on Wednesday November 01, 2023 @11:55AM (#38100057)
I think most of that was coming from the (then) next generation JS crowd who was trying to fit everything into one neat little box. They've since burnt themselves out and found the limitations in their approach during the process.
Re:A bank runs serverless with PHP and AWS Lambda by Muromec on Wednesday November 01, 2023 @03:41PM (#38103800)
I’m the usual suspect for shi^W questioning php and I think you are wrong about demographics.
Re:A bank runs serverless with PHP and AWS Lambda by solardev on Wednesday November 01, 2023 @12:55PM (#38101142)
Just a perspective:

PHP 7+ (the language) was wonderful, especially compared to Javascript's woefully inadequate standard library. It had so many helper functions that made even working with JSON and big data objects much easier.

But having to manage its buildchain wasn't fun (meaning needing to containerize a web server, PHP-FPM, etc. for every trivial deployment). Then needing to support an OS behind it with updates and such, even Dockerized.

For serverless in particular, the availability of V8 isolates (like in CF Workers) or other "just run this snippet of code and don't bother me about the infra" services (like Lambda) or "I can host my serverless in a file alongside my other frontend stuff" (like on Vercel/Netlify) means that JS functions are pretty much zero-config 1-click deploys.

Is there anything like that in the PHP world? For Bref, for example, you have to set up a lot of stuff before the serverless will run: https://bref.sh/docs/setup

For Google Cloud Run (which supports auto-scaling containerized PHP, not true serverless but closer to it than a full VM), you have to manage docker: https://cloud.google.com/run/docs/quickstarts/build-and-depl...

Maybe the closest one I know of is a Google Cloud Function (https://cloud.google.com/functions/docs/create-deploy-http-p...) which comes close to the "function as a service" of JS serverless, but you still at a minimum have to deal with a tiny folder structure (index.php + composer.json).

Is there anything similar on AWS or elsewhere?

Re:A bank runs serverless with PHP and AWS Lambda by distantsounds on Wednesday November 01, 2023 @01:09PM (#38101364)
your container running the web server and php-fpm should only need to be deployed once. the point of PHP is that to update your code you just... replace the file. this sounds like a poorly designed CI pipeline that is of no fault of PHP.
Re:A bank runs serverless with PHP and AWS Lambda by solardev on Wednesday November 01, 2023 @01:55PM (#38102145)
What? There was no CI involved. It's more a matter of being able to spin up separate environments for different teams, projects, or especially clients. Both for security and billing and resource allocation etc.
Re:A bank runs serverless with PHP and AWS Lambda by gumballindie on Wednesday November 01, 2023 @03:31PM (#38103626)
I think it’s more about people ignoring PHP. I worked with PHP for a long time and was extremely happy to move away from it. PHP developers usually lack understanding of engineering practices and make things up that sound like engineering. Generally speaking I now advice everyone to avoid that language. Use python or nodejs if you want something cool for the web. PHP is dead.
Re:A bank runs serverless with PHP and AWS Lambda by justinsaccount on Wednesday November 01, 2023 @11:25AM (#38099516)
It also makes sense if you look at things in the context of Choose Boring Technology [1]. If you have a working PHP app and want to scale into the cloud, you can use a single innovation token to move the app into lambda. This is the key sentence:

> To do a controlled migration, the team deployed the application both to the servers and to AWS Lambda. Only 10 lines of code needed to be changed to run the monolith on AWS Lambda.

[1] https://mcfunley.com/choose-boring-technology

Re:A bank runs serverless with PHP and AWS Lambda by mikece on Wednesday November 01, 2023 @11:49AM (#38099933)
Interesting to re-read that article again and see that technologies he cites as so cutting edge you're spending innovation tokens on them are now mainstream and very well understood. What would the new "you can use those but you're spending innovation tokens!" technologies would be. Rust? AI? CGP?
Re:A bank runs serverless with PHP and AWS Lambda by djbusby on Wednesday November 01, 2023 @12:15PM (#38100420)
AI for sure. Rust maybe less. The big thing about these tokens is, folk spend them too early and try to use them for everything.

Part of choose boring is more about choose the right tool.

Would you build a PoC webapp by having AI generate Rust? Or, just bang out a few lines of PHP or JS? If the objective is to build a working business tool it's choice B; if the objective is to test AI making Rust then A

Re:A bank runs serverless with PHP and AWS Lambda by bogota on Wednesday November 01, 2023 @11:30AM (#38099597)
hur dur php bad because they told me
Re:A bank runs serverless with PHP and AWS Lambda by romanhn on Wednesday November 01, 2023 @11:38AM (#38099733)
I mean, it's not like that sentiment is totally baseless. I've used PHP years ago and both language and core libraries were not well-designed and came with many footguns. I've heard that modern PHP with frameworks like Laravel fixed a bunch of this, so presumably it's quite capable these days. But PHP certainly wouldn't be anywhere near the top of my go-to list at this point.
Re:A bank runs serverless with PHP and AWS Lambda by munk-a on Wednesday November 01, 2023 @12:08PM (#38100303)
Eh, at this point can we just stop with the echoing of old memes? I used PHP4 and have used it continuously up to the modern day. If it's not your choice of language that's fine - language choice is pretty unimportant in the grant scheme of things... that said, it can do everything you need it to do (outside of low level memory control). If you need bit-efficient data structures it isn't going to be a good fit... but compared with most other system programming languages it's fine. I'd even go so far as to say it's one of the leading language in terms of meta-programming at this point with an excellent Reflection suite and great built-in magic methods.
Re:A bank runs serverless with PHP and AWS Lambda by rob on Wednesday November 01, 2023 @12:57PM (#38101174)
It's alright. I'll be busy getting some easy WordPress work that's fun to do (especially if you use Laravel with it with the roots.io ecosystem) while people are trying to get their obscure Rust blog with leptos/X to compile to WASM so they can deploy it to fly.io and use their remote hosted database for 5 users/month.
Re:A bank runs serverless with PHP and AWS Lambda by Muromec on Wednesday November 01, 2023 @03:45PM (#38103848)
I think the point of making the blog on whatever cool tech of the day, instead of wordpress is later getting a job involving said cool tech, not the blog itself.
Re:A bank runs serverless with PHP and AWS Lambda by smrtinsert on Wednesday November 01, 2023 @01:26PM (#38101620)
I don't know a single dev across the years who has ever made php their first choice.
Re:A bank runs serverless with PHP and AWS Lambda by munk-a on Wednesday November 01, 2023 @02:17PM (#38102495)
Hi, I'm munk-a. It's good to meet you!

I really enjoy PHP because it's easy to prototype in, there are a plethora of highly useful libraries for it, it has quite a few mature frameworks[1] and the language syntax is quite powerful.

1. Laravel gets a lot of attention but I'm a huge fan of Zend/Laminas.

Re:A bank runs serverless with PHP and AWS Lambda by Implicated on Wednesday November 01, 2023 @04:45PM (#38104910)
/wave

I've tried to leave, I've explored outside the relationship. I've dealt with thorns and rough edges. But I've grown, the language and ecosystem have grown and it's been _wonderful_. I truly consider _not leaving_ the PHP ecosystem when I gave an earnest effort to explore elsewhere one of the best decisions I've ever made.

I love to build cool shit and PHP makes that _ridiculously_ easy.