示例

真实应用,端到端验证

从 Laravel 到 WordPress,都跑在 OxPHP 上——每份配方都是一个自包含的 Docker Compose 项目:Dockerfile、compose 文件、安装命令,以及那些为 nginx + PHP-FPM 编写的文档不会涉及的细节。

Laravel

框架模式的典范应用。

PHP
8.5
路由模式
框架模式
服务
MySQL
安装
composer create-project
environment · docker-compose.yml
ENTRY_FILE=index.php
INTERNAL_ADDR=0.0.0.0:9090
ACCESS_LOG=all
说明

ENTRY_FILE=index.php 会选择框架模式:public/ 成为文档根目录,因此 .env、app/ 和 vendor/ 永远无法通过 HTTP 访问。

容器环境变量会覆盖 .env——Laravel 的 dotenv 加载器绝不会覆盖真实的环境变量,因此在 Compose 中设置的 DB_HOST 和 APP_ENV 会生效。

开发镜像会在每个请求上重新校验 OPcache;对绑定挂载的 src/ 所做的修改会立即生效。

Built on the published image

Every Dockerfile copies the oxphp binary, liboxphp_bridge.so and the SAPI extension from ghcr.io/oxphp/oxphp. The PHP ABI must match: compile your app's extensions against the same php:<X.Y>-zts-alpine.

Routing mode follows the app's shape

One front controller under public/ → framework mode. Several physical entry points → traditional mode. One decision replaces the whole nginx rewrite file.

Security defaults, no config

Dot-path blocking 404s .env and .git/ everywhere; PHP_DENY_PATHS hardens upload dirs in traditional mode; SYMLINK_ALLOW_PATHS allows only deliberate symlink escapes.

Install through the same container

The dev image carries the PHP CLI and Composer: artisan, drush, wp and bin/magento all run via docker compose exec — no separate toolchain.

你的技术栈不在列表里?

任何带有前端控制器的应用都能以框架模式运行——从 Laravel 配方开始,调整三个变量即可。