Before Beginning
PHP is an excellent choice for beginners to learn about development of Web App. For a PHP learner, if you want to share your works to others, making it to an Android App is a best choice without establishing a website. Don’t worry about matters, what we need is just a mobile phone!
HopWeb App can just make an Android App from a PHP project.
Content
- Preparations
- Preview Project
- Customize Your App
- Install & Share Your App
- FAQ
Preparations
- HopWeb (Version 2.7.0 or above, download via Google Play)
- An Android phone with Android 8.0 and above. (64-bit ARM CPU is also necessary.)
Create or Import A PHP project on HopWeb
- Open HopWeb, create a PHP project by pressing [Create Project] button. And then check “PHP Template”.
If you want to import an existing PHP project, you can press [IMPORT PROJECT] button on “Create Project” dialog, and then choose the ZIP file of your project.
Furthermore, you could download a project that is shared by others on ideaSky. As a demonstration, I downloaded the resource named “Simple User System”. You can find it by searching RID: IDEA-10002.
Go back Home after downloading, and you can see the project. Just open it.
Preview Project
HopWeb has a built-in PHP environment, so that you can preview the PHP project directly through HopWeb.
- Touch the “≡” icon in the left to open project manager.
- Click
index.html
orindex.php
to open the file and preview it by the green triangle icon in the bottom right corner. - Let’s register an account, and log in then.
- You can find the registered accounts information in the
data
folder. Clear the content of fileusers.json
to delete registered accounts.
Customize Your App
- If you want to use a different icon rather than the default, you need to import the icon image file to the project first.
Click [Import]-[Import Media File], and choose an image file you like. You can see the image file you imported in the file list after importing.
- Click [Publish Your Website], and click [Convert to Android App] then.
- Click [Application Icon] and choose the image file we’ve just imported.
- Modify other information of the App to your liking. Don’t forget to check [Carry PHP Environment].
- After customizing, press the OK icon at the bottom of the page to produce the APK installer file.
Install & Share Your App
- After conversion, go back to the project manager, and refresh the file list by swiping it down. You can see the produced APK file.
- You could open the system file manager App and locate into “Internal storage -> Venter -> HopWeb -> Simple User System”, and you will see the APK file. Install by clicking on it.
- Open your App, and the webpage has become a client application. The PHP code can also run as normal.
FAQ
- There is an error when open the produced App: The port of PHP environment may be incorrect. You can modify the port in the Convert to Android App page. The range of ports is 1024 ~ 65535. Common ports like 8080 are not recommended.
- The PHP project used MySQL: HopWeb will support database server like MySQL in the future version, but not currently supported.
- Incompatible PHP version: The PHP version of HopWeb 2.7.0 is 8.2.8. If your PHP project uses some syntactic features of PHP 7, there may be some problems.
- System requirement of produced App: Require Android 6.0 and above systems. The architecture of CPU must be ARM 64.