packwise-skills 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/.cursorrules +23 -0
  2. package/CLAUDE.md +25 -0
  3. package/README.md +295 -0
  4. package/audit.md +224 -0
  5. package/bin/packwise.js +155 -0
  6. package/package.json +31 -0
  7. package/skill.md +719 -0
  8. package/sub-skills/ai/local-llm.md +183 -0
  9. package/sub-skills/ai/python-ml.md +164 -0
  10. package/sub-skills/backend/go-server.md +184 -0
  11. package/sub-skills/backend/java-spring.md +241 -0
  12. package/sub-skills/backend/node-server.md +164 -0
  13. package/sub-skills/backend/php-laravel.md +175 -0
  14. package/sub-skills/backend/python-server.md +164 -0
  15. package/sub-skills/backend/rust-backend.md +118 -0
  16. package/sub-skills/cli/python-cli.md +236 -0
  17. package/sub-skills/cli/sdk-library.md +497 -0
  18. package/sub-skills/cloud/ci-cd-pipelines.md +350 -0
  19. package/sub-skills/cloud/docker.md +191 -0
  20. package/sub-skills/cloud/kubernetes.md +277 -0
  21. package/sub-skills/cloud/payment-integration.md +307 -0
  22. package/sub-skills/cross-platform/multiplatform.md +252 -0
  23. package/sub-skills/desktop/electron.md +783 -0
  24. package/sub-skills/desktop/game-dev.md +443 -0
  25. package/sub-skills/desktop/native-app.md +123 -0
  26. package/sub-skills/desktop/scenarios.md +443 -0
  27. package/sub-skills/desktop/smart-platforms.md +324 -0
  28. package/sub-skills/desktop/tauri.md +428 -0
  29. package/sub-skills/desktop/vr-ar.md +252 -0
  30. package/sub-skills/desktop/web-to-desktop.md +153 -0
  31. package/sub-skills/embedded/car-infotainment.md +129 -0
  32. package/sub-skills/embedded/esp32.md +184 -0
  33. package/sub-skills/embedded/ros.md +150 -0
  34. package/sub-skills/embedded/stm32.md +160 -0
  35. package/sub-skills/mobile/android.md +322 -0
  36. package/sub-skills/mobile/capacitor.md +232 -0
  37. package/sub-skills/mobile/flutter-mobile.md +138 -0
  38. package/sub-skills/mobile/harmonyos.md +150 -0
  39. package/sub-skills/mobile/ios.md +245 -0
  40. package/sub-skills/mobile/react-native.md +443 -0
  41. package/sub-skills/mobile/wearables.md +230 -0
  42. package/sub-skills/plugins/browser-extension.md +308 -0
  43. package/sub-skills/plugins/jetbrains-plugin.md +226 -0
  44. package/sub-skills/plugins/vscode-extension.md +204 -0
  45. package/sub-skills/security/security-tools.md +174 -0
  46. package/sub-skills/web/monorepo.md +274 -0
  47. package/sub-skills/web/pwa.md +220 -0
  48. package/sub-skills/web/serverless-edge.md +295 -0
  49. package/sub-skills/web/spa.md +266 -0
  50. package/sub-skills/web/ssr.md +228 -0
  51. package/sub-skills/web/wasm.md +243 -0
@@ -0,0 +1,241 @@
1
+ # Java/Spring Boot Build Sub-Skill
2
+
3
+ Build and package Java backend services using Spring Boot, Quarkus, or Micronaut.
4
+
5
+ **Current version**: Java 21 LTS / 22 / Spring Boot 3.5.x / Quarkus 3.37.x / Micronaut 5.x (2025-2026)
6
+
7
+ ## When to Use
8
+
9
+ - Enterprise backend services
10
+ - REST APIs / GraphQL APIs
11
+ - Microservices architecture
12
+ - Team has Java/Kotlin experience
13
+ - Need mature ecosystem (Spring ecosystem)
14
+
15
+ ## Spring Boot Build
16
+
17
+ ### Maven Build
18
+
19
+ ```bash
20
+ # Clean + package
21
+ mvn clean package -DskipTests
22
+ # Output: target/myapp-1.0.0.jar
23
+
24
+ # Run
25
+ java -jar target/myapp-1.0.0.jar
26
+
27
+ # Build with specific profile
28
+ mvn clean package -Pproduction
29
+ ```
30
+
31
+ ### Gradle Build
32
+
33
+ ```bash
34
+ ./gradlew clean build -x test
35
+ # Output: build/libs/myapp-1.0.0.jar
36
+
37
+ # Run
38
+ java -jar build/libs/myapp-1.0.0.jar
39
+ ```
40
+
41
+ ### Fat JAR vs Thin JAR
42
+
43
+ | Type | Size | Startup | Best For |
44
+ |------|------|---------|----------|
45
+ | Fat JAR (default) | 50–200MB | Standard | Simple deployment, Docker |
46
+ | Thin JAR | < 10MB | Faster (dependencies cached) | Multiple services sharing deps |
47
+ | Native Image (GraalVM) | 30–80MB | Ultra fast (< 1s) | Serverless, CLI, microservices |
48
+
49
+ ### GraalVM Native Image
50
+
51
+ ```bash
52
+ # Install GraalVM
53
+ sdk install java 21.0.2-graal
54
+
55
+ # Maven plugin (in pom.xml):
56
+ # <plugin>
57
+ # <groupId>org.graalvm.buildtools</groupId>
58
+ # <artifactId>native-maven-plugin</artifactId>
59
+ # </plugin>
60
+
61
+ mvn -Pnative native:compile
62
+ # Output: target/myapp (native binary, no JVM required)
63
+ ```
64
+
65
+ ## Docker
66
+
67
+ ```dockerfile
68
+ FROM eclipse-temurin:21-jdk-jammy AS builder
69
+ WORKDIR /app
70
+ COPY pom.xml .
71
+ COPY src/ src/
72
+ RUN apt-get update && apt-get install -y maven && mvn clean package -DskipTests
73
+
74
+ FROM eclipse-temurin:21-jre-jammy
75
+ WORKDIR /app
76
+ COPY --from=builder /app/target/*.jar app.jar
77
+ RUN groupadd -r appuser && useradd -r -g appuser appuser && \
78
+ chown -R appuser:appuser /app
79
+ USER appuser
80
+ EXPOSE 8080
81
+ HEALTHCHECK --interval=30s --timeout=3s CMD curl -f http://localhost:8080/actuator/health || exit 1
82
+ ENTRYPOINT ["java", "-jar", "app.jar"]
83
+ ```
84
+
85
+ ```dockerfile
86
+ # GraalVM native image Docker (smaller, faster)
87
+ FROM ghcr.io/graalvm/native-image-community:21 AS builder
88
+ WORKDIR /app
89
+ COPY target/myapp .
90
+ RUN native-image --static -o myapp-native myapp
91
+
92
+ FROM debian:bookworm-slim
93
+ COPY --from=builder /app/myapp-native /myapp
94
+ RUN groupadd -r appuser && useradd -r -g appuser appuser
95
+ USER appuser
96
+ EXPOSE 8080
97
+ CMD ["/myapp"]
98
+ ```
99
+
100
+ ## jpackage (Native Installers for Java Desktop/CLI Apps)
101
+
102
+ `jpackage` is a JDK 14+ tool that creates native platform installers from JAR files — no JVM required on the target machine.
103
+
104
+ ```bash
105
+ # Prerequisites: JDK 17+ with jpackage (included in JDK 14+)
106
+
107
+ # 1. Build fat JAR first
108
+ mvn clean package -DskipTests
109
+
110
+ # 2. Create native installer
111
+ # Windows (.exe / .msi)
112
+ jpackage --type exe \
113
+ --input target/ \
114
+ --main-jar myapp-1.0.0.jar \
115
+ --main-class com.example.Main \
116
+ --name MyApp \
117
+ --app-version 1.0.0 \
118
+ --icon src/main/resources/icon.ico \
119
+ --win-shortcut \
120
+ --win-menu
121
+
122
+ # macOS (.pkg / .dmg)
123
+ jpackage --type dmg \
124
+ --input target/ \
125
+ --main-jar myapp-1.0.0.jar \
126
+ --main-class com.example.Main \
127
+ --name MyApp \
128
+ --app-version 1.0.0 \
129
+ --icon src/main/resources/icon.icns \
130
+ --mac-package-identifier com.example.myapp
131
+
132
+ # Linux (.deb / .rpm)
133
+ jpackage --type deb \
134
+ --input target/ \
135
+ --main-jar myapp-1.0.0.jar \
136
+ --main-class com.example.Main \
137
+ --name MyApp \
138
+ --app-version 1.0.0 \
139
+ --icon src/main/resources/icon.png \
140
+ --linux-shortcut
141
+ ```
142
+
143
+ ### jpackage vs Docker vs GraalVM Native Image
144
+
145
+ | Approach | Output | JVM Required? | Size | Startup | Best For |
146
+ |----------|--------|--------------|------|---------|----------|
147
+ | jpackage | .exe/.msi/.dmg/.deb/.rpm | No (bundled JRE) | 40-100MB | 1-3s | Desktop/CLI distribution to non-technical users |
148
+ | Docker | Container image | Yes (in container) | 100-300MB | 2-5s | Server deployment |
149
+ | GraalVM Native | Native binary | No | 30-80MB | < 1s | Serverless, CLI, microservices |
150
+ | Fat JAR | .jar file | Yes (user must install JDK) | 50-200MB | 2-8s | Developer tools, server deployment |
151
+
152
+ ### jpackage with Spring Boot (Special Handling)
153
+
154
+ Spring Boot fat JARs have a nested JAR structure that `jpackage` doesn't handle well. Use the Spring Boot thin launcher or repack:
155
+
156
+ ```xml
157
+ <!-- pom.xml — Use Spring Boot thin launcher -->
158
+ <plugin>
159
+ <groupId>org.springframework.boot</groupId>
160
+ <artifactId>spring-boot-maven-plugin</artifactId>
161
+ <configuration>
162
+ <layout>ZIP</layout> <!-- Thin layout for jpackage compatibility -->
163
+ </configuration>
164
+ </plugin>
165
+ ```
166
+
167
+ ```bash
168
+ # Build thin JAR + dependencies
169
+ mvn clean package -DskipTests
170
+
171
+ # jpackage with classpath
172
+ jpackage --type exe \
173
+ --input target/ \
174
+ --main-jar myapp-1.0.0.jar \
175
+ --main-class org.springframework.boot.loader.launch.JarLauncher \
176
+ --name MyApp \
177
+ --app-version 1.0.0
178
+ ```
179
+
180
+ ### Common Pitfalls (jpackage)
181
+
182
+ | Issue | Fix |
183
+ |-------|-----|
184
+ | "jpackage not found" | Ensure JDK 17+ is installed (not JRE); `jpackage` is in `JAVA_HOME/bin` |
185
+ | Spring Boot JAR fails to launch | Use `layout: ZIP` in spring-boot-maven-plugin; or repack with `maven-shade-plugin` |
186
+ | Missing native libraries | Add `--java-options "-Djava.library.path=/app/libs"` |
187
+ | macOS notarization fails | Sign the .pkg with `codesign` before notarizing; jpackage doesn't auto-sign |
188
+ | Windows SmartScreen warning | Sign the .exe with EV/OV certificate after jpackage creates it |
189
+ | Large installer size | Use `--jlink-options "--strip-debug --compress zip-6"` to reduce bundled JRE size |
190
+ | Icon not showing | Ensure icon format is correct (.ico for Windows, .icns for macOS, .png for Linux) |
191
+
192
+ ## Quarkus Build
193
+
194
+ ```bash
195
+ # Create project (replace 3.37 with latest Quarkus version)
196
+ mvn io.quarkus.platform:quarkus-maven-plugin:3.37:create -DprojectGroupId=com.example -DprojectArtifactId=myapp
197
+
198
+ # JVM mode
199
+ mvn clean package
200
+ java -jar target/quarkus-run.jar
201
+
202
+ # Native mode (requires GraalVM)
203
+ mvn clean package -Pnative
204
+ ./target/myapp
205
+ ```
206
+
207
+ ## Micronaut Build
208
+
209
+ ```bash
210
+ # Create project
211
+ mn create-app com.example.myapp
212
+
213
+ # Build
214
+ ./gradlew clean build
215
+
216
+ # Native image
217
+ ./gradlew nativeCompile
218
+ # Output: build/native/nativeCompile/myapp
219
+ ```
220
+
221
+ ## Framework Comparison
222
+
223
+ | Feature | Spring Boot | Quarkus | Micronaut |
224
+ |---------|------------|---------|----------|
225
+ | Maturity | Most mature | Growing fast | Growing |
226
+ | Startup time | 2–8s (JVM), < 1s (native) | < 1s (native) | < 1s (native) |
227
+ | Memory | 200–500MB (JVM) | 30–80MB (native) | 30–80MB (native) |
228
+ | Native image | Supported (GraalVM) | First-class | First-class |
229
+ | Ecosystem | Largest (Spring) | Good (Vert.x-based) | Good (Netty-based) |
230
+ | Best for | Enterprise, large teams | Cloud-native, serverless | Microservices, serverless |
231
+
232
+ ## Common Pitfalls
233
+
234
+ | Issue | Fix |
235
+ |-------|-----|
236
+ | JAR too large (> 200MB) | Exclude unused dependencies; use Spring Boot thin launcher |
237
+ | GraalVM reflection errors | Add `reflect-config.json`; use `@RegisterForReflection` (Quarkus) |
238
+ | Slow startup in containers | Use CDS (Class Data Sharing); consider native image |
239
+ | Port conflict | Set `server.port` in `application.properties` or `SERVER_PORT` env |
240
+ | Database connection pool exhausted | Configure HikariCP pool size; add connection timeout |
241
+ | Actuator endpoints not exposed | Add `management.endpoints.web.exposure.include=health,info` |
@@ -0,0 +1,164 @@
1
+ # Node.js Backend Build Sub-Skill
2
+
3
+ Build Node.js backend services (Express/NestJS/Fastify/Koa/Hono).
4
+
5
+ **Current version**: Node.js 26 LTS / 22 LTS (2025-2026)
6
+
7
+ > ⚠️ **Breaking changes since Node 22**: v23 enables `require(esm)` by default. v26 removes `http.writeHeader()` (use `writeHead()`), removes legacy `_stream_*` modules, enables Temporal API, upgrades V8 to 14.6 and Undici to 8.0. Native modules compiled for Node 22 need recompilation for Node 26.
8
+
9
+ ## When to Use
10
+
11
+ - REST API / GraphQL API service
12
+ - WebSocket service
13
+ - Microservice / API gateway
14
+ - Full-stack application backend
15
+ - Serverless functions
16
+
17
+ ## Framework Quick Start
18
+
19
+ ### Express (Most Popular)
20
+
21
+ ```javascript
22
+ const express = require('express');
23
+ const app = express();
24
+ app.use(express.json());
25
+ app.get('/health', (req, res) => res.json({ status: 'ok' }));
26
+ app.listen(3000);
27
+ ```
28
+
29
+ ### Fastify (High Performance)
30
+
31
+ ```javascript
32
+ import Fastify from 'fastify';
33
+ const app = Fastify({ logger: true });
34
+ app.get('/health', async () => ({ status: 'ok' }));
35
+ await app.listen({ port: 3000 });
36
+ ```
37
+
38
+ ### NestJS (Enterprise, TypeScript-first)
39
+
40
+ ```bash
41
+ npm i -g @nestjs/cli
42
+ nest new my-app
43
+ npm run build # outputs to dist/
44
+ npm run start:prod
45
+ ```
46
+
47
+ ### Hono (Edge-first, ultra-lightweight)
48
+
49
+ ```javascript
50
+ import { Hono } from 'hono';
51
+ const app = new Hono();
52
+ app.get('/health', (c) => c.json({ status: 'ok' }));
53
+ export default app;
54
+ ```
55
+
56
+ ### Framework Comparison
57
+
58
+ | Framework | Performance | TypeScript | Ecosystem | Best For |
59
+ |-----------|------------|-----------|-----------|----------|
60
+ | Express | Good | Optional | Largest | General purpose, tutorials |
61
+ | Fastify | High | First-class | Large | Performance-critical APIs |
62
+ | NestJS | Good | Required (default) | Large | Enterprise, complex architecture |
63
+ | Koa | Good | Optional | Moderate | Minimalist Express alternative |
64
+ | Hono | Highest | First-class | Growing | Edge runtime, serverless |
65
+
66
+ ## Build
67
+
68
+ ```bash
69
+ # Express/Fastify/Koa/Hono: run directly (no build step for JS)
70
+ node dist/server.js
71
+
72
+ # TypeScript projects
73
+ npx tsc # Compile TypeScript to JS
74
+ # or esbuild (faster)
75
+ npx esbuild src/index.ts --bundle --platform=node --format=cjs --outfile=dist/server.cjs
76
+ # or tsx (run TypeScript directly, development)
77
+ npx tsx src/index.ts
78
+
79
+ # NestJS: requires compilation
80
+ npm run build # outputs to dist/
81
+
82
+ # Bun runtime (alternative to Node.js, faster)
83
+ bun run src/index.ts
84
+ ```
85
+
86
+ ## Docker
87
+
88
+ ```dockerfile
89
+ FROM node:22-alpine AS builder
90
+ WORKDIR /app
91
+ COPY package*.json ./
92
+ RUN npm ci
93
+ COPY . .
94
+ RUN npm run build
95
+
96
+ FROM node:22-alpine
97
+ WORKDIR /app
98
+ COPY --from=builder /app/dist ./dist
99
+ COPY --from=builder /app/node_modules ./node_modules
100
+ COPY --from=builder /app/package.json ./
101
+ RUN apk add --no-cache tini && \
102
+ addgroup -S appgroup && adduser -S appuser -G appgroup && \
103
+ chown -R appuser:appgroup /app
104
+ USER appuser
105
+ EXPOSE 3000
106
+ HEALTHCHECK --interval=30s --timeout=3s CMD wget -qO- http://localhost:3000/health || exit 1
107
+ ENTRYPOINT ["/sbin/tini", "--"]
108
+ CMD ["node", "dist/server.js"]
109
+ ```
110
+
111
+ ## PM2 Process Manager
112
+
113
+ ```bash
114
+ npm install -g pm2
115
+ pm2 start dist/server.js --name myapp -i max # Cluster mode (all CPU cores)
116
+ pm2 start dist/server.js --name myapp -i 4 # 4 instances
117
+ pm2 save && pm2 startup # Auto-start on reboot
118
+ pm2 logs myapp # View logs
119
+ pm2 monit # Monitoring dashboard
120
+ pm2 reload myapp # Zero-downtime restart
121
+ ```
122
+
123
+ ## Environment Variables
124
+
125
+ ```javascript
126
+ // Use dotenv for development
127
+ require('dotenv').config();
128
+
129
+ // Access: process.env.DATABASE_URL, process.env.PORT, etc.
130
+ // NEVER commit .env files to git
131
+ ```
132
+
133
+ ```bash
134
+ # Local: .env file (add to .gitignore)
135
+ # Production: platform env vars or secrets manager
136
+ # Type-safe env: use @t3-oss/env-nextjs or zod
137
+ ```
138
+
139
+ ## Cloud Platforms
140
+
141
+ | Platform | Method | Cost | Best For |
142
+ |----------|--------|------|---------|
143
+ | Railway | Git push auto-deploy | Free/pay-as-you-go | Quick deploy |
144
+ | Render | Git push auto-deploy | Free/pay-as-you-go | Quick deploy |
145
+ | Fly.io | Docker deploy | Free/pay-as-you-go | Global edge |
146
+ | Vercel | Serverless Functions | Free/pay-as-you-go | Next.js, API routes |
147
+ | AWS EC2 | PM2/Docker | Per instance | Full control |
148
+ | Aliyun ECS | PM2/Docker | Per instance | China access |
149
+ | Deno Deploy | Git push | Free tier | Hono, edge functions |
150
+ | Bun.sh | `bun run` | Free tier | Ultra-fast startup |
151
+
152
+ ## Common Pitfalls
153
+
154
+ | Issue | Fix |
155
+ |-------|-----|
156
+ | Port in use | `lsof -i :3000` to check; use `kill -9 <PID>` |
157
+ | Memory leak | PM2: `--max-memory-restart 500M`; check for event listener leaks |
158
+ | Process crash loop | Check logs: `pm2 logs`; add error handling middleware |
159
+ | CORS error | `app.use(cors())` with Express; configure allowed origins |
160
+ | HTTPS in production | Nginx reverse proxy + Let's Encrypt (see cloud/docker.md) |
161
+ | `MODULE_NOT_FOUND` | Check `node_modules`; run `npm ci` (not `npm install` in production) |
162
+ | TypeScript path aliases not working | Use `tsc-alias` or `tsconfig-paths` after build |
163
+ | Async error not caught | Use `express-async-errors` or wrap in try/catch |
164
+ | Bun compatibility | Some npm packages don't support Bun; test thoroughly |
@@ -0,0 +1,175 @@
1
+ # PHP Backend Build Sub-Skill
2
+
3
+ Build and package PHP backend services (Laravel / Symfony / Slim).
4
+
5
+ **Current version**: PHP 8.3 / 8.4 / Laravel 11.x / Symfony 7.x (2025-2026)
6
+
7
+ ## When to Use
8
+
9
+ - Content management systems (WordPress plugins, custom CMS)
10
+ - REST APIs / GraphQL APIs
11
+ - Web applications with server-side rendering
12
+ - Team has PHP experience
13
+ - Shared hosting deployment
14
+
15
+ ## Laravel Build
16
+
17
+ ### Build & Package
18
+
19
+ ```bash
20
+ # Install dependencies
21
+ composer install --no-dev --optimize-autoloader
22
+
23
+ # Cache configuration (production)
24
+ php artisan config:cache
25
+ php artisan route:cache
26
+ php artisan view:cache
27
+ php artisan event:cache
28
+
29
+ # Build frontend assets
30
+ npm ci && npm run build
31
+
32
+ # Create distributable archive
33
+ tar -czf myapp.tar.gz \
34
+ --exclude='.env' \
35
+ --exclude='node_modules' \
36
+ --exclude='tests' \
37
+ --exclude='.git' \
38
+ .
39
+ ```
40
+
41
+ ### Docker
42
+
43
+ ```dockerfile
44
+ FROM php:8.3-fpm AS builder
45
+ WORKDIR /app
46
+ COPY composer.json composer.lock ./
47
+ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
48
+ composer install --no-dev --optimize-autoloader --no-scripts
49
+ COPY . .
50
+ RUN php artisan config:cache && php artisan route:cache && php artisan view:cache
51
+
52
+ FROM php:8.3-fpm
53
+ WORKDIR /app
54
+ COPY --from=builder /app /app
55
+ RUN groupadd -r appuser && useradd -r -g appuser appuser && \
56
+ chown -R appuser:appuser /app/storage /app/bootstrap/cache
57
+ USER appuser
58
+ EXPOSE 9000
59
+ HEALTHCHECK --interval=30s --timeout=3s CMD php artisan --version || exit 1
60
+ CMD ["php-fpm"]
61
+ ```
62
+
63
+ ### Nginx + PHP-FPM
64
+
65
+ ```nginx
66
+ server {
67
+ listen 80;
68
+ server_name example.com;
69
+ root /app/public;
70
+ index index.php;
71
+
72
+ location / {
73
+ try_files $uri $uri/ /index.php?$query_string;
74
+ }
75
+
76
+ location ~ \.php$ {
77
+ fastcgi_pass app:9000;
78
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
79
+ include fastcgi_params;
80
+ }
81
+ }
82
+ ```
83
+
84
+ ### Shared Hosting Deployment
85
+
86
+ ```bash
87
+ # 1. Run `composer install --no-dev` locally
88
+ # 2. Upload via FTP/SFTP:
89
+ # - All files EXCEPT: .env.example, .git, node_modules, tests
90
+ # 3. Set document root to `public/` directory
91
+ # 4. Copy .env.example → .env and configure
92
+ # 5. Run: php artisan key:generate
93
+ # 6. Set permissions: chmod -R 775 storage bootstrap/cache
94
+ ```
95
+
96
+ ### Laravel Forge / Vapor / Ploi
97
+
98
+ | Platform | Type | Best For |
99
+ |----------|------|---------|
100
+ | Laravel Forge | VPS management | Full control, traditional hosting |
101
+ | Laravel Vapor | Serverless (AWS Lambda) | Auto-scaling, pay-per-request |
102
+ | Ploi | VPS management | Alternative to Forge |
103
+
104
+ ## Symfony Build
105
+
106
+ ```bash
107
+ # Install dependencies
108
+ composer install --no-dev --optimize-autoloader
109
+
110
+ # Warm up cache
111
+ php bin/console cache:warmup --env=prod
112
+
113
+ # Build frontend (if using Encore)
114
+ npm ci && npm run build
115
+
116
+ # Docker
117
+ docker build -t myapp .
118
+ ```
119
+
120
+ ```dockerfile
121
+ FROM php:8.3-fpm AS builder
122
+ WORKDIR /app
123
+ COPY composer.json composer.lock ./
124
+ RUN composer install --no-dev --optimize-autoloader
125
+ COPY . .
126
+ RUN php bin/console cache:warmup --env=prod
127
+
128
+ FROM php:8.3-fpm
129
+ WORKDIR /app
130
+ COPY --from=builder /app /app
131
+ USER www-data
132
+ EXPOSE 9000
133
+ ```
134
+
135
+ ## Slim / Lumen (Micro-frameworks)
136
+
137
+ ```php
138
+ // Slim 4 — minimal API
139
+ use Slim\Factory\AppFactory;
140
+
141
+ $app = AppFactory::create();
142
+ $app->get('/health', function ($request, $response) {
143
+ $response->getBody()->write('OK');
144
+ return $response;
145
+ });
146
+ $app->run();
147
+ ```
148
+
149
+ ```bash
150
+ # Build
151
+ composer install --no-dev
152
+ php -S 0.0.0.0:8080 -t public public/index.php
153
+ ```
154
+
155
+ ## PHP Distribution Channels
156
+
157
+ | Channel | Method | Best For |
158
+ |---------|--------|---------|
159
+ | Composer Packagist | `composer publish` | Libraries / packages |
160
+ | Docker Hub | `docker push` | Containerized apps |
161
+ | Shared hosting | FTP/SFTP upload | WordPress, small sites |
162
+ | VPS | `git pull` + `composer install` | Full control |
163
+ | Serverless (Bref) | `vendor/bin/bref deploy` | AWS Lambda |
164
+
165
+ ## Common Pitfalls
166
+
167
+ | Issue | Fix |
168
+ |-------|-----|
169
+ | `composer install` fails in prod | Use `--no-dev`; check PHP version compatibility |
170
+ | 500 error after deploy | Check `.env` config; run `php artisan config:clear` |
171
+ | Storage permissions | `chmod -R 775 storage bootstrap/cache`; set correct owner |
172
+ | OPcache not working | Enable `opcache.enable=1` in php.ini; restart PHP-FPM |
173
+ | Memory limit exceeded | Increase `memory_limit` in php.ini (default 128M, use 256M+) |
174
+ | Asset mix not compiling | Run `npm ci && npm run build`; check `webpack.mix.js` / `vite.config.js` |
175
+ | Shared hosting: `artisan` not available | Use `php artisan` with full path; some hosts restrict CLI |