PHPRunner 9 adds an option to build and package desktop applications as well as web applications. In this article we'll try to answer most common questions and explain what PHPRunner desktop applications can and can not do.
How it works
First of all, Desktop apps functionality is built on the top of wonderful open source PHP Desktop project. PHP Desktop packages together the following software components:
- web server (Mongoose)
- Chrome browser
When you start PHP Desktop application it start the web server first specifying 'www' directory as website root folder. Then it starts Chrome browser pointing to web server's home page. Browser application is modified to hide all menus, navigation buttons and address bar. You just see the application itself. This is pretty much it. You can download PHP Desktop and play with it on its own putting any PHP code to 'www' folder and starting phpdesktop-chrome.exe file.
PHPRunner takes one extra step packaging the whole application into a single installable EXE file. We use Inno Setup for this purpose. The whole packaging process is described with great details in excellent Create Your First Desktop Application With PHP And PHP Desktop tutorial.
- Windows only
PHP Desktop runs on Windows only.
- PHP only
PHP Desktop, apparently, is for PHP only. However, since a standalone IIS Express browser exists we can expect at some point that
- Installer is not signed
This is not a big deal when you only distribute your application among your company users. If you want to make desktop version of your app available worldwide you definitely need to sign the installer. Check this post for more info. Probably at some point we'll add signing support to PHPRunner. You will still need to obtain your own
- Not an offline version
For some reason people confuse 'desktop' with 'offline version of online application'. Desktop application is no different from the web application except it sits on your desktop. If your application uses a remote database you do need Internet connection to connect to that database.
Some typical use cases of desktop version
- You need to create a desktop application. You are a PHP developer who needs to create a desktop application. PHPRunner can help you with this. The natural choice is to use SQLite or MS Access database in this case.
- You need to create an application that doesn't use database at all. An example - Euro 2016 desktop application. It connects to football-data.org API, retrieves data and displays it. You don't need a website or a database in this scenario.
- When you need an access to hardware or to file system. Using a desktop app you can access devices connected to end user machine, work with file system, use COM objects etc. You can do pretty much everything the typical desktop application can.
- You can use your desktop application to connect to remote database. This is the less typical scenario but still plausible. Probably you do not have a website or do not want to maintain a website, take case of security etc. All you have is a database like MySQL or Amazon RDS with remote access. In this case desktop application can be useful as well.