Agent Skillsnixopus/nixopus › php-deploy

php-deploy

GitHub

用于构建和部署PHP应用,支持Laravel、Symfony等框架。自动检测环境、依赖及框架类型,生成Dockerfile,处理Composer安装、启动优化及Node.js集成,确保高效稳定的PHP服务发布。

api/skills/php-deploy/SKILL.md nixopus/nixopus

Trigger Scenarios

需要部署PHP项目 检测到composer.json或index.php文件

Install

npx skills add nixopus/nixopus --skill php-deploy -g -y
More Options

Non-standard path

npx skills add https://github.com/nixopus/nixopus/tree/master/api/skills/php-deploy -g -y

Use without installing

npx skills use nixopus/nixopus@php-deploy

指定 Agent (Claude Code)

npx skills add nixopus/nixopus --skill php-deploy -a claude-code -g -y

安装 repo 全部 skill

npx skills add nixopus/nixopus --all -g -y

预览 repo 内 skill

npx skills add nixopus/nixopus --list

SKILL.md

Frontmatter
{
    "name": "php-deploy",
    "metadata": {
        "version": "1.0"
    },
    "description": "Build and deploy PHP applications — Composer, Laravel, Symfony, FrankenPHP, PHP-FPM, and Dockerfile patterns. Use when deploying a PHP project, or when composer.json or index.php is detected."
}

PHP Deployment

Detection

Project is PHP if any of these exist:

  • composer.json at the build context root
  • index.php at the root

Versions

PHP 8.2+ only.

  1. composer.jsonrequire.php (e.g. ">=8.2")
  2. .php-version or mise.toml / .tool-versions
  3. Defaults to 8.4

Package Manager

Composer. Detect composer.json and composer.lock.

Has lock file Command
yes composer install --no-dev --optimize-autoloader
no composer install --no-dev --optimize-autoloader

Document Root

Laravel and Symfony use public/. Generic PHP uses the project root.

PHP Extensions

Detected from composer.jsonrequire section with ext-* entries.

Framework Detection

Signal Framework
artisan Laravel
symfony.lock or config/ structure Symfony
wp-config.php WordPress
index.php + routing Generic PHP

Laravel-Specific

When artisan is present:

  • Document root: public/
  • Migrations run by default during startup. Skip by setting SKIP_MIGRATIONS=true.
  • Storage symlinks, optimization
  • Build-time artisan caches: config, routes, views, events
  • Storage directory must be writable

Startup Process

  1. Run migrations (Laravel; skip if SKIP_MIGRATIONS=true)
  2. Create storage symlinks (Laravel: php artisan storage:link)
  3. Optimize (Laravel: config/route/view cache)
  4. Start PHP server (FrankenPHP, PHP-FPM, or php -S)

Override by providing custom start-container.sh in project root.

Node.js Integration

If package.json detected alongside PHP (e.g. Laravel + Vite):

  • Install Node.js
  • Run npm install or equivalent
  • Execute build scripts from package.json
  • Prune dev dependencies in final image

Install Stage Optimization

Copy composer.json + composer.lock first for layer caching.

Caching

RUN --mount=type=cache,target=/root/.composer/cache \
    composer install --no-dev --optimize-autoloader

Base Images

Use case Image
FrankenPHP dunglas/frankenphp:latest or dunglas/frankenphp:php8.4
PHP-FPM php:8.4-fpm-alpine
CLI / built-in server php:8.4-cli-alpine

Dockerfile Patterns

Laravel with FrankenPHP

FROM composer:2 AS deps
WORKDIR /app
COPY composer.json composer.lock ./
RUN composer install --no-dev --optimize-autoloader

FROM php:8.4-cli-alpine AS build
WORKDIR /app
COPY --from=deps /app/vendor ./vendor
COPY . .
RUN php artisan config:cache && php artisan route:cache && php artisan view:cache

FROM dunglas/frankenphp:php8.4
WORKDIR /app
COPY --from=build /app .
EXPOSE 8080
CMD ["frankenphp", "run", "--config", "/app/Caddyfile"]

Generic PHP + Composer

FROM composer:2 AS deps
WORKDIR /app
COPY composer.json composer.lock ./
RUN composer install --no-dev --optimize-autoloader

FROM php:8.4-fpm-alpine
WORKDIR /app
COPY --from=deps /app/vendor ./vendor
COPY . .
EXPOSE 9000
CMD ["php-fpm"]

Gotchas

  • Laravel storage/ and bootstrap/cache/ must be writable — chown these directories in the Dockerfile for non-root users
  • FrankenPHP defaults to port 8080, not 80 — ensure EXPOSE and proxy config match
  • Composer post-autoload-dump scripts may fail during Docker build if the app isn't fully configured — use --no-scripts during install, then run composer dump-autoload --optimize after copying source
  • PHP OPcache should be enabled in production (opcache.enable=1, opcache.validate_timestamps=0) for significant performance gains
  • Extensions listed in require as ext-* must be installed in the Docker image — they are not bundled with base PHP images

Version History

  • cf05d97 Current 2026-08-20 14:52

Same Skill Collection

api/skills/api-catalog/SKILL.md
api/skills/caddyfile-generation/SKILL.md
api/skills/compose-setup/SKILL.md
api/skills/container-resource-tuning/SKILL.md
api/skills/cpp-deploy/SKILL.md
api/skills/database-migration/SKILL.md
api/skills/deno-deploy/SKILL.md
api/skills/deploy-delegation/SKILL.md
api/skills/deploy-flow/SKILL.md
api/skills/deployment-analysis/SKILL.md
api/skills/diagnostic-workflow/SKILL.md
api/skills/dockerfile-generation/SKILL.md
api/skills/dockerignore-generation/SKILL.md
api/skills/domain-attachment/SKILL.md
api/skills/domain-tls-routing/SKILL.md
api/skills/dotnet-deploy/SKILL.md
api/skills/elixir-deploy/SKILL.md
api/skills/failure-diagnosis/SKILL.md
api/skills/github-onboarding/SKILL.md
api/skills/github-workflow/SKILL.md
api/skills/gleam-deploy/SKILL.md
api/skills/go-deploy/SKILL.md
api/skills/incident-response/SKILL.md
api/skills/java-deploy/SKILL.md
api/skills/machine-ops/SKILL.md
api/skills/mcp-integrations/SKILL.md
api/skills/monorepo-strategy/SKILL.md
api/skills/nixopus-docs/SKILL.md
api/skills/node-deploy/SKILL.md
api/skills/onboarding/SKILL.md
api/skills/post-deploy-verification/SKILL.md
api/skills/pre-deploy-checklist/SKILL.md
api/skills/python-deploy/SKILL.md
api/skills/rollback-strategy/SKILL.md
api/skills/ruby-deploy/SKILL.md
api/skills/rust-deploy/SKILL.md
api/skills/self-heal/SKILL.md
api/skills/shell-deploy/SKILL.md
api/skills/static-deploy/SKILL.md

Metadata

Files
0
Version
cf05d97
Hash
ba914587
Indexed
2026-08-20 14:52

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-30 01:05
浙ICP备14020137号-1 $Гость$