←back to thread

133 points avan1 | 2 comments | | HN request time: 0.615s | source
Show context
hu3 ◴[] No.45077689[source]
> In short, the modern PHP ecosystem gives us the best of both worlds: the ability to build quickly and confidently in PHP, while still having powerful options (C, Rust, Go) for performance-critical parts. This hybrid approach lets us stay productive without sacrificing speed where it matters most.

I understand this for a large codebase where rewriting is not feasible.

But if that wasn't the case, a C# APIs achieves both speed of development and execution in my experience. You'll rarely need to reach for C++ or Rust.

PHP is great but the language still doesn't allow things like typed arrays. It will happily accept string in a array of dates, for example.

replies(5): >>45077729 #>>45077935 #>>45078609 #>>45079138 #>>45081157 #
ThinkBeat ◴[] No.45077935[source]
Having been in the C# world for a long time, and the various web/api frameworks.

PHP is really nice if you dig into it, it includes so many great functions and functionality built in for creating web stuff.

It also has a number of issues,. but to quikly put something together PHP take the win in my limited opnion.

replies(3): >>45078266 #>>45079032 #>>45081636 #
DoctorOW ◴[] No.45081636[source]
To give an example, my main website is C#, I love it from a dev perspective and performance perspective. But I also have PHP on my personal server and will knock out PHP scripts for one off demo projects. I just ssh into my server, `vim projects/example.php` and it's instantly deployed as a link I can share.
replies(1): >>45083465 #
1. hu3 ◴[] No.45083465[source]
There's `dotnet run` now. You can:

vim projects/example.cs

    var builder = WebApplication.CreateBuilder(args);
    var app = builder.Build();
    app.MapGet("/", () => "Hello World!");
    app.Run();
dotnet run projects/example.cs

Not the same as PHP I know, but it's close enough for me.

replies(1): >>45083628 #
2. DoctorOW ◴[] No.45083628[source]
I'm glad it works for you but I guess that doesn't really cover the use case I was talking about because I want to have a bunch of these. As an example, I threw together a quick web hook processor, data from one service reformatted to fit another. I don't really need to spin up a whole new VPS for an endpoint that'll only be hit once or twice a week, so this is the workflow for doing that on the server I already have.

PHP:

   - vim projects/webhook.php
C#:

   - vim projects/webhook.cs
   - Assign a port number
   - Reconfigure Nginx/Caddy to serve that port number
   - Reconfigure systemd to dotnet run projects/webhook.cs on startup