Live data from Hacker News

Show HN: I reinvented PHP in TypeScript (demo)

github.com

1–10 of 34 posts

Show HN: I reinvented PHP in TypeScript (demo)

#1
I built Morph, an experimental fullstack HTML-first library for Deno, Node, and Bun.

Everything returns HTML, not JSON. No React, no Vite — just plain HTML with server-side rendering.

No build steps, no preprocessors, no complex configs — everything runs from a single file.

Perfect for Telegram Web Apps, internal tools, simple admin panels, dashboards, or anywhere a full-blown SPA feels like overkill.

Important: I built this entirely for myself — to solve my own problems. I hate complex frontend. I hate writing it. And I don’t want to waste time on it. But maybe it’ll help you too.

Show HN: I reinvented PHP in TypeScript (demo)
github.com

Re: Show HN: I reinvented PHP in TypeScript (demo)

#3
My naive question: so if I have node, express, and JS tagged template literals. Is not that what PHP does. Route some url to a html interpolated with code.

What is the add-on from this library? The only thing I read out of it, is some css and other templating benefits. Which is not the essence of PHP. The essence of PHP is that you mix html and code (which many JS tagged templates support).

This goes more in the direction of component oriented development (e.g. what Blazor does... even Angular). So my rant is about comparing it with PHP.

Not a node & browser dev, but I have my past in PHP and currently some Blazor.

Re: Show HN: I reinvented PHP in TypeScript (demo)

#6
PHP is a templating languages designed to be so inadequate that you have to implement other templating languages in it.

https://news.ycombinator.com/item?id=32961202

>PHP was already a templating language, but somebody got it in their head that there should be an iron-clad separation between designers and programmers, and that PHP gave designers too much power and confused them, and that their incompetent untrustworthy designers who refused to learn anything about programming deserved something even "simpler" than PHP, so they came up with Smarty.

>Then over time the realized that their designers were powerless, so their programmers would have to learn TWO languages so they could wade into the Smarty templates to make them actually work with all the extra code they had to write because Smarty was so crippled, so they nickle-and-dimed more and more incoherent programming language elements into Smarty, making it EVEN HARDER to use and more complicated and less consistent than PHP, yet nowhere near as powerful.

Re: Show HN: I reinvented PHP in TypeScript (demo)

#7

PHP is a templating languages designed to be so inadequate that you have to implement other templating languages in it. https://news.ycombinator.com/item?id=32961202 >PHP was already a templating language, but somebody got it in their head that there should be an iron-clad separation between designers and programmers, and that PHP gave designers too much power and confused them, and that their incompetent untrustwort…

Modern PHP is not a templating language. It can be, much like many other languages can be, but it's not how it is used. Most other languages also implement their own templating languages. Have you seen modern PHP ... I don't know, sometime in the last 10 or so years, or is this just another circle jerk of hating on something you have little clue about?

Now if you see that as a bad thing, separating business logic and presentation, and sandboxing presentation so it has no larger access to the system, then I'm afraid you're just not a good programmer.

Re: Show HN: I reinvented PHP in TypeScript (demo)

#8
post #2

So this is supposed to be following the practices that were common in PHP ten years ago? Modern PHP is not written in such a way where business logic is mixed with templating. For good reason.

For applications you're right.

For trivial scripts, though, that practice is still pretty common. You don't necessarily need Twig or whatever if you just need a script to spit out the rows from a single database query.

Re: Show HN: I reinvented PHP in TypeScript (demo)

#9
post #3

My naive question: so if I have node, express, and JS tagged template literals. Is not that what PHP does. Route some url to a html interpolated with code. What is the add-on from this library? The only thing I read out of it, is some css and other templating benefits. Which is not the essence of PHP. The essence of PHP is that you mix html and code (which many JS tagged templates support). This goes more in the dire…

php has not been "mix html & code" for the last 10 years if you use it properly

Re: Show HN: I reinvented PHP in TypeScript (demo)

#10
post #5

I think this misses one of the main selling points of PHP, the shared nothing, single thread, fire and forget methodology that I can throw behind a load balancer and spin up 100 servers.

You can probably use something like https://www.cgi-node.org/ to get close to the PHP model in the JS world.

But, I wouldn't be surprised if its slower than PHP due to the overhead of starting up NodeJS for each request, as PHP has been optimised to have fast start times.

Post reply on HN