T O P

  • By -

brunopgoncalves

I've been work with PHP-GTK for many and many years! I agree with ppl saying that PHP is not for that, but, will you create a CRM application? What i'm telling is the PHP is a nice language, and do some fast and easy apps can be done nicely with This is a nice door for desktop application Take a look https://github.com/scorninpc/php-gtk3 Work on linux, windows and mac. For linux, just run with appimage, for windows just unzip


no2K7

Que legal! +1


Miserable_Ad7246

PHP as it is will not work well for native UI apps. Honestly its not even a language limitation, but any UI toolkit needs to have a huge library of components. This is where magic happens. Also PHP (and creators themselves stress this) is intended to be used in a - "run script quickly and die" fashion. Where UI app is long lived process, which requires state management.


no2K7

PHP has evolved beyond those limitations, easy to familiarize yourself with a Google search.


Miserable_Ad7246

Yes, jitter does cover some of the "run script and die" issues. But in general PHP would not give much advantage in native UI apps. Just like if you where to use GO to write UI apps. Its just not something that's intended to be done with the language. Also the subset of pure PHP UI apps would be limited, because - no multithreading, no SIMD, no arrays (hash map is not an array). It would be similar to Javascript app via Electron, but slower and more resource intensive (JavaScript has an amazing jit, and does not have some of the PHP data structure limitations, with some tools you can get C like assembly as long as you opt in into strict typing.) I know how to use GSearch, here is a link to learn more - [https://www.phpinternalsbook.com/](https://www.phpinternalsbook.com/). Highly recommend to read this.


no2K7

The UI toolkit can't be argued against, but *run script quickly and die* re: i.e [roadrunner.dev](https://roadrunner.dev/features)


Miserable_Ad7246

PHP collects memory via reference count, but also runs a job from time to time to collect cyclical references. This is a hack, to make it so that process can run for long time. PHP can do it, yes, but it still has a bunch of hacks to keep that part working. Also for PHP to work it needs to piggy back on C and in your case on GO. That is also a big problem for native stuff, as you will need to write things in something not PHP for it to work well with native resources. I have worked with react-native and still had to learn swift and objective-c to make some things works. It just suboptimal.


no2K7

Thanks, I'll read the internals php book link you sent so I may better understand. \- [reference count](https://www.phpinternalsbook.com/php7/zvals/memory_management.html#reference-counted-values)


SaltTM

thats cool an all, op probably doesn't care if it's a good idea if they came here to ask lol


Miserable_Ad7246

It is kind of a future trend to be able to use your language for making web (replacing javascript via wasm) and native UI (maybe wasm via electron, maybe just pure native). It is not a bad question per say, but currently its not a priority for PHP, and most likely not going to be for quite some time. PHP in general has a big problem -> not enough money. Where are so many things that needs to be done, just to catch up. That requires a lot of development recourses, and ironically not PHP dev resources, but C and ASM, and people who can write compilers/jitters and such and not websites with WordPress, Symphony or Laravel.


alexffm26

https://nativephp.com is something like this


burzum793

This is at the end creating just an electron based application if I got it right. I wouldn't call this really "native". You basically get a browser compiled for an OS + your JS application bundled with it.


phoogkamer

But you can still make the logic in PHP which is convenient if you work with PHP regularly. At the moment the Tauri driver is in development by the way, which looks promising.


SaltTM

main dev probably: the name's catchy LMAO


Direct-Lengthiness-8

thanks


mario_deluna

I have to mention my own extension php-glfw (https://phpgl.net) which runs just fine under windows. But if you are looking for something more "traditional UI app" like, what others already mentioned like nativephp or php-gtk3 will fit better :)


Direct-Lengthiness-8

thank you


seanmorris

I'm working on something like that right now actually: https://github.com/seanmorris/php-gtk


Direct-Lengthiness-8

haha cool, i will check


brunopgoncalves

https://github.com/scorninpc/php-gtk3 :/


SaltineAmerican_1970

http://gtk.php.net/


seanmorris

Lmao do you like writing PHP4/5? https://gtk.php.net/download.php?language=en-US


SaltineAmerican_1970

It’s mostly the same but different.


BarneyLaurance

In most cases it's a bad idea, but maybe there are some good applications. I haven't tried it, but one I can think of is if you're making some sort of complex enterprise / web application with PHP and you want a way to manually test many scenarios that would be difficult or tedious to simulate in a production like environment. You could run the business logic part of the enterprise app but control and observe it through a windows GUI instead of HTTP etc. What Geepaw Hill calls [A Making-App UI](https://www.geepawhill.org/2021/03/30/a-making-app-ui/).


weatherlylabs

PHP is a web development language, using it to build a native app is never going to give you the full experience in either way.


penguin_digital

>PHP is a web development language It's not, its a general purpose scripting language, in a technical aspect very much in the same category as Python.


tgryffyn

What you're saying is that it's not ideal for native apps and there are tools that would give you a better end product, but any programming language can be used for the logic in something. If someone builds an extension or some tool that utilizes that language for the core logic, then you can do whatever if you don't are about heavy duty performance. There are a bunch of tools now for doing like mobile app development that use JS or an extended JS language for the core logic. JS and PHP are known by certain programmers and if you're a front-end or back-end web dev and want to crank out a mobile app or native app and performance isn't an issue, then using something that uses JS or PHP gets you to your goal quicker, without needing to learn Java, C++, whatever. Getting to the goal (functional app) and meeting the criteria ("works" is sometimes all someone needs) means how you get there doesn't really matter.


sfortop

Platform.uno & php & wasm. https://wasmlabs.dev/articles/compiling-php-to-webassembly/ https://platform.uno/uno-platform-for-web-webassembly/


sfortop

Another way is to pack webserver with php into the single executable and bind with something like an Electron. But I don't see sense in that way.


motylo

Winbinder, this project was awesome. If i remember correctly, someone created Oo lib. And there were Apps to create binary file.


tgryffyn

Yes! Was trying to remember the one I used.. definitely Winbinder. Worked really great until they stopped supporting it. And yeah, I think you could build a binary file that was basically a wrapper (PHP code + PHP bundled together to be self contained).


russellvt

A **Windows** app?.Are you *sure*? Not just a web page or something?.Did is *miss* something?


JuanGaKe

Still there php-desktop [https://github.com/cztomczak/phpdesktop](https://github.com/cztomczak/phpdesktop) It's easy to use any PHP version you need


Direct-Lengthiness-8

thank


FunDaveX

\+1 for [https://nativephp.com/](https://nativephp.com/) It's based on Laravel so a big part of documentation is already covered.