6 ms·
Show HN: A terminal emulator in pure PHP
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- cf100clunk 2y agoNice, but your terminal app has a name collision with the long lived ''screen'' terminal multiplexer utility: https://www.gnu.org/software/screen/manual/screen.html https://www.gnu.org/software/screen/manual/screen.html
- aarondf 2y agoThanks for your feedback!
- cf100clunk 2y agoTo me, name collisions are only a big deal if the app or project exists in very similar use case scenarios. In this case, I'd say confusion could easily happen if ''screen'' replaced ''screen'' in the path or a call. How about "Soloterm"? Have you thought of others?
- jeffhuys 2y agoNot only confusion, but inability to just install on mac/linux, right? I believe both come with screen by default… Edit: let me actually think a bit before commenting - it would probably just install, but then you run screen and you might or might not get your newly-installed software (so yeah confusion). Not a great first experience at worst
- deleted 2y ago[deleted]
- aarondf 2y agoIt's a package you install into your PHP application. It's impossible for it to collide.
- cf100clunk 2y agoQuestion: can you call GNU screen from within screen?
- aarondf 2y ago> Question: can you call GNU screen from within screen? No. It's literally just an in memory buffer that you interact with from PHP. In Solo (https://github.com/soloterm/solo https://github.com/soloterm/solo) we do use GNU screen though.
- cf100clunk 2y agoThanks, good to know. You and others may have noticed some odd activities in this thread (I use Refined Hacker News and can see them) so I'm glad for your responses to my well-meant comments.
- aarondf 2y agoYeah someone's really got a vendetta against SA and HN right now huh? Weird stuff!
- jmholla 2y agoIt seems to me that you can, from within the terminal that it provides, I supposed depending on what shell you run within the emulator. Your example even shows you running tail, so I expect it's running some sort of shell I'd expect screen could be available on. Unless, this terminal emulator is missing specific features that mean screen doesn't work in it, which would make me feel the definition has been stretched a little here. Either way, I have to heavily agree with duskwuff's take: > They're both pieces of software which implement or interact with terminal emulators; I think some deconfliction is warranted here. Edit: I've learned from a different comment [0] that the latter is indeed the case. This isn't really a terminal emulator. [0]: https://news.ycombinator.com/item?id=43438797#43439716 https://news.ycombinator.com/item?id=43438797#43439716
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- pmarreck 2y ago[flagged]
- aarondf 2y agoThanks for the... rant? Sorry you've had such a rough time. I use GNU Screen in Solo, where I also use Solo Screen, so I am aware of it. https://github.com/soloterm/solo/blob/main/src/Commands/Concerns/ManagesProcess.php#L101 https://github.com/soloterm/solo/blob/main/src/Commands/Conc...
- calvinmorrison 2y agoas your average PHP enjoyer, I agree with all of these complaints, but also will note - you really need to train the team on PHP footguns, which are as bad as C foot guns - finding PHP programmers is easy. - your shits already written in PHP - in the same way rolling your own stdlib in C is silly, leverage good PHP frameworks ymmv but its not that bad. at least it keeps my day exciting.
- pmarreck 2y agofair points. looking back on this comment from 3 days ago... all I can say is that my toddler kid isn't sleeping through any night consistently :/
- lpapez 2y agoYou come across as pretty opinionated and eager to comment for someone who states they don't care. I work with spaghetti PHP every day. It pays the bills. There are far worse jobs out there. The expert wishes to fix the tedious tasks. But a true master understands that all tasks are equally tedious. Relax and enjoy the ride.
- pmarreck 2y ago> There are far worse jobs out there. Fair enough. But there are also far better. I can't help caring about this one. It's a curse. lol
- 2y ago
- atarian 2y agoI was hoping for an actual desktop app powered by PHP, which would be really cool having PHP as a desktop runtime.
- aarondf 2y agoAlas
- aarondf 2y agoYou might enjoy https://nativephp.com/ https://nativephp.com/
- endofreach 2y agoLol, what? Haven't heard of this... What's your experience with nativePHP? While i am a defender of modern (!) php for web applications, this does sound rather weird. But also interesting. Thanks for the link. I wonder though how "native" this is? Glancing over the docs it seems to be built upon tauri / electron? Not as native as i expected, but probably more native than most people would dare to think about...
- aarondf 2y agoI haven't used it for anything, but it is developed by some friends of mine. It's certainly a novel approach! And they got it working on iOS too
- noduerme 2y agoLol indeed... I also still love PHP. For most small apps that's my go to backend, because who needs to worry about keeping Node running on some server you forgot about 2 years ago? And it's a fully modern language. I'm delighted that there's some kind of desktop API here. On the one hand, the fact that it's talking with an Electron shell seems sort of magical. But it begs questions like, why wouldn't I just use a fully JS stack? And... since I've never created a graphical app in PHP before, would this be the right time to start?
- noduerme 2y ago
- electroly 2y agoI'm a little confused--is it an interactive terminal? Or is it more like an ANSI renderer where you are producing a single static image of the final result of printing a series of bytes? I don't see any JavaScript to hint at interactivity.
- aarondf 2y agoNope. Not interactive. It's a library you can use inside of PHP to implement a virtual screen. The readme has some pretty thorough details!
- jmholla 2y agoI don't think you can call this a terminal emulator then.
- aarondf 2y agoMaybe not! Help me understand then. What would you call a library that parses ANSI codes, handles scrolling, screen movement, clearing, resets, etc?
- electroly 2y agoPerhaps something along the lines of an "ANSI terminal renderer library"? I think "render" helps suggest that it's handling the display but that the library consumer still has to handle interactivity and any UI chrome. The consumer is the terminal emulator app and this component is the renderer.
- aarondf 2y agoCool, thanks!
- anthk 2y agoANSI/VT100 renderer. A full terminal emulator would connect to a tty interface, run subshells and so on.
- whalesalad 2y agoscript kiddies are now going to have high-fidelity shells with 256 colors for when they pwn you and get root on your godaddy drupal install sidenote: screen is a terrible name for this as there is already gnu/screen (colloquially referred to as screen) which has 38 years head start - https://en.wikipedia.org/wiki/GNU_Screen https://en.wikipedia.org/wiki/GNU_Screen also til screen is older than me
- aarondf 2y agoI am also older than you then, probably
- deleted 2y ago[deleted]
- throwaway150 2y agoCommendable work but note that this is not a terminal emulator. This is a terminal renderer.
- aarondf 2y agoThank you!
- blueflow 2y agoWhat functionality does a program need to emulate to be a terminal emulator?
- doubled112 2y agoInteractive use.
- blueflow 2y agoYou just made that up, didn't you
- doubled112 2y agoEverything is made up initially, isn’t it?
- deleted 2y ago[deleted]
- mrweasel 2y agoDidn't we have this back in 2001. I seems to remember that we kicked a guy of our project because he installed one of the PHP consoles on our Solaris box, which basically gave it the same rights as the Apache user.
- aarondf 2y agoNot sure, I was 12
- codetrotter 2y ago11 at the time here. For me it would be another 10 years or so before I saw a Solaris box or even knew what one was. I did encounter, and try, Linux much sooner. But didn’t really “get it” either at the time. Like, I understood that it was neat and different. I installed Mandriva Linux on my machine when I was 13 or 14 or so, but I was lacking any books or guidance to understand how to do anything aside from opening the GUI programs that was on it. It would take all until the age of 18, when I started at the university, before I got the help I needed in order to understand Linux and editing config files on Linux and writing my own scripts and programs on Linux.
- johnisgood 2y ago> I installed Mandriva Linux on my machine when I was 13 or 14 or so, but I was lacking any books or guidance to understand how to do anything aside from opening the GUI programs that was on it. It was Gentoo for me at the age of 13 that a random Hungarian guy from Finland helped install through SSH. I did try SUSE around the age of 11, nothing interesting though, the interesting stuff came after Gentoo. :D
- jamal-kumar 2y agoIt's still a mainstay of certain malware for sure. Just pop in 'php shell' to your favorite search engine, and it's basically all stuff for either red teaming or shenanigans
- cship2 2y ago
- aarondf 2y agoThanks for all the feedback! I've updated the readme to use the word "renderer" rather an "emulator." Gonna stick with the name screen though
- donatj 2y agoOh, interesting! I started a very similar project probably ten years ago and just never got it to a very usable state. My idea at the time was based in wanting to be able to write tests for the final output of scripts full of control codes. I am very excited to see this and to play with it!
- aarondf 2y agoCheck out the ComparesVisually trait! (It's described in the readme too) It takes some text, outputs it to iTerm and takes a screenshot. Then it takes the same output, runs it through the Screen class, outputs it, and takes a screenshot. Then we compare the screenshots pixel by pixel. So freakin fun
- adminm 2y agoI'm curious how you came to the conclusion that naming it 'screen' was the best thing for your project? It's unusual to see so many negative comments on a new project announcement and yet you persist and even double down with a sarcastic "thanks for your feedback" reply.
- aarondf 2y agoSure I can explain it a bit. I named it screen because the main class is called screen. It was extracted from another library to make maintenance easier. It's not a tool that can ever be used outside of a PHP project, and it has no binary. It's namespaced under SoloTerm. A nice analogy would be a package named @clerk/auth and then everyone complaining about the package being named auth. I mean it is... but that's not really the full name or how anyone would refer to it. Most commenters didn't understand any of that nuance and got hung up on a surface level thing that didn't really matter. It was clear to me that the suggestion didn't apply in this case so I thanked them for the feedback. I don't have to take the feedback! Several other folks commented that it's not really an emulator but rather a renderer. I thought that was a pretty good point and something I was wrong about. So I changed the readme! I thanked them for their feedback as well. It's no secret that HN commenters lean cynical and can miss the majors for the minors. I just don't want to fight with them! I'm grateful for feedback. Some of it I take and some I completely ignore. As everyone should!
- goshx 2y agoKudos to you for taking all the heat and handling it gracefully. Perhaps adding a screenshot or video to the README.md showing what it does could help people understand it better.
- aarondf 2y agoThanks! I know it's probably bizarre behavior to not debate at all in the comments, but man, life is short. Good note on the screenshot. There are some code samples but I'll think if there's a way to add a visual. It's tough cause it's just a library that you consume in PHP! But I'll noodle nonetheless.
- MrBuddyCasino 2y agoDoes it render to plain text or styled HTML? Not quite clear from the readme.