6 ms·
Amateur here. This is good for what? Why somebody should use this instead of normal?
by msavara 2y ago
Amateur here. This is good for what? Why somebody should use this instead of normal?
- bpbp-mango 2y agoMigrating a legacy PHP code-base to .net maybe
- hparadiz 2y agoIt looks like this compiles PHP code to a .net binary but it doesn't support all of PHP so it's kinda useless for most projects. Benefits of this are dubious at best. The php interpreter is already a low level C project so why replace that with .net? Makes no sense.
- CiaranMcNulty 2y agoA major difference will be that PeachPie produces a compiled deploy artefact, while mainstream PHP is interpreted (albeit with heavy opcode caching and a JIT in production)
- 0points 2y ago> The php interpreter is already a low level C project so why replace that with .net? You are comparing apples with pies here. PHP is a interpreted language, while .NET is a compiled target. However, this peachpie project seems to be far from stated goal and more of a research project currently.
- mnau 2y agowe have attempted to use it for that, but it was really hard and we ended up rewriting from scratch. The activity graph on GitHub says it is mostly dead. There is some activity, but at best it is in maintenance mode. It used to be sponsored, but not anymore IIRC https://github.com/peachpiecompiler/peachpie/graphs/contributors https://github.com/peachpiecompiler/peachpie/graphs/contribu...
- chrisandchris 2y agoIMHO, besides the fun to create such a project (and all the thibgs you learn while doing it), it's not for much. It tries to bring a technology somewhere (presuambly the desktop, as asp.net and PHP are already comparable) it's not designed for - which will bring you in trouble sooner or later. It's like JavaScript on the server, it's ok but there are languages better suited for this environment. It's much faster to learn C# in the long term than to run PHP on top of .Net.
- bob1029 2y agoC# has poor man's PHP baked in these days: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated https://learn.microsoft.com/en-us/dotnet/csharp/language-ref... And, it's getting better over time: https://github.com/dotnet/csharplang/issues/4935 https://github.com/dotnet/csharplang/issues/4935 This is essentially how I respond to web requests in my codebases right now: var table = $@"<table> <tr><th>Name</th></tr> {string.Join('\n', items.Select(i => $"<tr><td>{i.Name}</td></tr>"))} </table>";
- okeuro49 2y agoThe defining feature of PHP isn't really string templating, but its shared-nothing architecture. https://slack.engineering/taking-php-seriously/ https://slack.engineering/taking-php-seriously/ I would consider poor man's PHP as something to reimplement that architecture, rather than any particular language feature.
- pjmlp 2y agoI fail to see why anyone sane would use this way over Razor files.
- bob1029 2y agoI use it to avoid the gauntlet of AspNetCore dependencies and weird editor bs around cshtml files.
- 2y ago
- deleted 2y ago[deleted]
- Quothling 2y agoI'm not sure why anyone would use it, but it was probably a fun project to make. I do think the statement on their landing page which reads: "Compile and run PHP on top the modern, secure and highly performant .NET runtime" perhaps is a little disingenuous. This might just be me, but I read it as though they imply that PHP isn't those things, which would be a silly statement to make in 2024.
- diggan 2y agoFrom the README: > Project goals: Both-way interoperability, Full .NET compatibility, Security, Cross-platform development, Increased performance - https://github.com/peachpiecompiler/peachpie https://github.com/peachpiecompiler/peachpie So seems they're aiming to use the PHP language but on a different runtime, for the listed reasons. Sounds kind of out there, but seems at least the .Net Foundation supports it, I'm guessing for the same reasons.
- SamuelAdams 2y agoMay also be useful for creating automatic language support from a single codebase. For example, Amazon uses JSII to build a typescript library into Python, Go, dotnet, etc. Maybe this tooling will help add PHP to that list. That way you are not maintaining 6 codebases. https://github.com/aws/jsii https://github.com/aws/jsii
- unnouinceput 2y agoFor obfuscation reasons mainly. Hide your genius code from a php base so your IP is not poached/discovered by Amazon and the likes who love to get brilliant open source made project, move a line and call it their own.
- hu3 2y agoSome might dislike your snark but obfuscation is a good use for this.
- nurettin 2y agoYou have a php project, and you want to use .net libraries.