Documentation
Everything you need to know to build amazing applications with ExoPHP.
Introduction
What is ExoPHP?
ExoPHP is a cross-platform desktop application framework designed specifically for PHP developers. It enables you to build native desktop applications for Windows, Linux, and other supported platforms using PHP as the backend language and modern web technologies for the user interface.
Developers can use any frontend framework that compiles to HTML, CSS, and JavaScript, including plain HTML/CSS/JavaScript, React, Vue, Angular, and others. ExoPHP combines the simplicity of web development with the power of desktop applications, allowing PHP developers to create fast, lightweight, and secure desktop software.
Installation
Downloading ExoPHP
Download the appropriate installer for your operating system from the ExoPHP homepage:
- Windows:
.exe - Debian/Ubuntu:
.deb - Fedora/RHEL:
.rpm
After installation, the exophpcommand will be available from your terminal.
Creating Your First Application
Initialize a new ExoPHP project:
$ exophp create MyAppThis command creates a new project directory containing the default application template.
Development Workflow
Running the Application
Start the application in development mode:
$ exophp runExoPHP will launch your application and automatically start the embedded PHP server.
Building the Application
Package your application for distribution:
$ exophp buildThe generated package is built for your current operating system and is ready for distribution.
Project Structure
A newly created project contains the following files and directories:
MyApp/
├── app.json
├── index.php
├── script.js
├── style.css
├── icon.png
└── bin/
└── phpThe provided files serve as a starter template and can be modified or replaced with your own application code.
Configuration
Application settings are stored in the app.json file.
Example:
{
"title": "My ExoPHP App",
"description": "A professional desktop application built with ExoPHP",
"version": "1.0.0",
"icon": "icon.png",
"window": {
"width": 1000,
"height": 800,
"resizable": true
},
"php": {
"port": null,
"bin": "bin/php"
}
}Configuration Options
Application Information
| Property | Description |
|---|---|
title | Application title displayed in the window title bar. |
description | Short description of the application. |
version | Application version number. |
icon | Application icon file. |
Window Settings
| Property | Description |
|---|---|
width | Initial window width. |
height | Initial window height. |
resizable | Allows users to resize the application window. |
PHP Settings
| Property | Description |
|---|---|
bin | Path to the bundled PHP executable. |
port | Server port used by the embedded PHP server. |
If port is set to null, ExoPHP automatically selects an available port at runtime. Alternatively, you can specify a fixed port number.
Bundled PHP Runtime
Every ExoPHP project includes its own PHP runtime located inside the bin directory:
bin/phpThis allows applications to run independently without requiring PHP to be installed on the target system.
Working with Databases and Resources
Applications built with ExoPHP create temporary runtime files during execution. These files are automatically generated when the application starts and are removed when the application exits.
If your application uses a database or other files that must persist between sessions, do not store them in the temporary runtime directory. Any files placed in the runtime directory will be deleted when the application closes.
Instead, store databases and other persistent resources inside your application's bin directory and reference them using the appropriate file paths.
Linux Installation
On Linux, installed applications are typically located at:
/opt/<application-name>When developing your application, ensure that database connections and resource paths point to files within the bin directory. This ensures that required resources remain available after installation and are not affected by the temporary runtime cleanup process.
Example
Recommended:
/opt/myapp/bin/database.db
/opt/myapp/bin/user-data.json
/opt/myapp/bin/settings.ini
/opt/myapp/bin/app-data.sqliteSecurity and Code Protection
When building an application, ExoPHP automatically applies code protection mechanisms to help safeguard your source code.
PHP Protection
PHP source code is protected using:
- YAK Pro - PHP Obfuscator
Frontend Protection
Developers have full control to optimize their frontend assets:
- Minify JS & CSS code
- Obfuscate custom script files
Since frontend asset compilation is handled by your framework of choice, these optimizations can be performed during your frontend build process before packaging with ExoPHP.
Frontend Framework Support
ExoPHP supports any frontend technology that produces standard web assets:
This flexibility allows developers to use their preferred frontend stack while leveraging PHP for backend application logic.
CLI Reference
ExoPHP provides a simple command-line interface (CLI) for creating, developing, building, and managing applications.
Create a New Project
Create a new ExoPHP application:
$ exophp create <AppName>Example:
$ exophp create MyAppRun in Development Mode
Launch the application in development mode:
$ exophp runBuild for Distribution
Package the application for the current operating system:
$ exophp buildDisplay Version Information
Display the currently installed ExoPHP version:
$ exophp --versionor
$ exophp -vDisplay Help Information
Show all available commands and options:
$ exophp --helpor
$ exophp -hCommand Summary
| Command | Description |
|---|---|
exophp create <AppName> | Create a new ExoPHP project. |
exophp run | Run the application in development mode. |
exophp build | Build and package the application. |
exophp --version | Display the installed ExoPHP version. |
exophp -v | Short form of --version. |
exophp --help | Display help information. |
exophp -h | Short form of --help. |