Run PHP as a Cross-Platform Desktop Application

mattster 7 Tallied Votes 1K Views Share

Recently I've stumbled on a nice tool that I really quite like, so I thought I'd share it:

Personally, I love the power behind PHP. I find it a very simple to use yet possesses the techniques seen in the more complex desktop applications such as Perl/Python/C/C++/C# etc. PHP has always been restricted to server-side web applications, and unlike the others, cannot run as a desktop application – until now. I would like to share an awesome tool I’ve been using recently…

PHP Nightrain is a cool bit of kit: it fully supports popular frameworks such as Laravel and CakePHP, and will run PHP/HTML/CSS/JS freely on Windows, Mac & Linux.

I would write a pretty little tutorial to show you how to install it (which is btw is incredibly easy), but the Nightrain guys are so good they’ve made platform-specific videos to show you (WindowsMac). Nightrain comes with PHP 5.5+ built in, and can easily run things like AngularJS and Drupal too (there's a preview on their website). The runtime error reporting is excellent, and shows a really nice breakdown for debugging.

I’ve looked into PHP GTK and things like that, but all have either been abandoned, not cross-platform or aren’t as easy to change between distributions.

The best bit, it’s released under the MIT licence & totally FREE/OPEN SOURCE!

With any luck a few people might have a go and it will be interesting to see what you guys think.

broj1 commented: Interesting. Thnx for sharing. +11
diafol commented: Good link +15
almostbob commented: trying to crash it, won't crash, cool +13
Traevel commented: Definitely worth a look, nice! +6
lps commented: nice tools +4
edbr 22 Junior Poster

looks good , struggling a bit setting up PDO and sqlite but seems to be a path problem

rpv_sen 59 Junior Poster

Good

Member Avatar for iamthwee
iamthwee

Wow thanks for sharing this, I'll take a look into it sometime tomorrow!

Kyle Wiering 17 Engineering Manager

Nightrain is an interesting Python wrapper of a PHP webserver running on localhost. It still uses up a port. Essentially, someone made a browser for PHP and burried all the browser elements to make it look like an application.

Yes, it does allow you to make a 'application' looking thing. However - in its current state you cannot even hide the console window in the background.

Currently, php can run standalone as a 'desktop application' - but it does not have a decent method for visual rendering (i.e. it runs command line). The optimum approach to convert to a Desktop application would involve php without a webserver running.

Anyhow, it is a good effort, it 'looks' like what you might want for an application - but it definately does not behave like one.

diafol commented: havent tried it yet - good observation - thanks +15
RikTelner commented: Thank you for your contribution. +2
Gideon_1 15 Junior Poster

thanks man, i got to look at this

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.