packwise-skills 1.0.0 → 1.2.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 (53) hide show
  1. package/.cursorrules +23 -23
  2. package/CLAUDE.md +25 -25
  3. package/LICENSE +21 -0
  4. package/README.md +404 -295
  5. package/audit.md +224 -224
  6. package/bin/packwise.js +322 -155
  7. package/install.sh +123 -0
  8. package/package.json +32 -31
  9. package/skill.md +944 -719
  10. package/sub-skills/ai/local-llm.md +183 -183
  11. package/sub-skills/ai/python-ml.md +164 -164
  12. package/sub-skills/backend/go-server.md +184 -184
  13. package/sub-skills/backend/java-spring.md +241 -241
  14. package/sub-skills/backend/node-server.md +164 -164
  15. package/sub-skills/backend/php-laravel.md +175 -175
  16. package/sub-skills/backend/python-server.md +164 -164
  17. package/sub-skills/backend/rust-backend.md +118 -118
  18. package/sub-skills/cli/python-cli.md +236 -236
  19. package/sub-skills/cli/sdk-library.md +497 -497
  20. package/sub-skills/cloud/ci-cd-pipelines.md +350 -350
  21. package/sub-skills/cloud/docker.md +191 -191
  22. package/sub-skills/cloud/kubernetes.md +277 -277
  23. package/sub-skills/cloud/payment-integration.md +307 -307
  24. package/sub-skills/cross-platform/multiplatform.md +252 -252
  25. package/sub-skills/desktop/electron.md +783 -783
  26. package/sub-skills/desktop/game-dev.md +443 -443
  27. package/sub-skills/desktop/native-app.md +123 -123
  28. package/sub-skills/desktop/scenarios.md +443 -443
  29. package/sub-skills/desktop/smart-platforms.md +324 -324
  30. package/sub-skills/desktop/tauri.md +428 -428
  31. package/sub-skills/desktop/vr-ar.md +252 -252
  32. package/sub-skills/desktop/web-to-desktop.md +153 -153
  33. package/sub-skills/embedded/car-infotainment.md +129 -129
  34. package/sub-skills/embedded/esp32.md +184 -184
  35. package/sub-skills/embedded/ros.md +150 -150
  36. package/sub-skills/embedded/stm32.md +160 -160
  37. package/sub-skills/mobile/android.md +322 -322
  38. package/sub-skills/mobile/capacitor.md +232 -232
  39. package/sub-skills/mobile/flutter-mobile.md +138 -138
  40. package/sub-skills/mobile/harmonyos.md +150 -150
  41. package/sub-skills/mobile/ios.md +245 -245
  42. package/sub-skills/mobile/react-native.md +443 -443
  43. package/sub-skills/mobile/wearables.md +230 -230
  44. package/sub-skills/plugins/browser-extension.md +308 -308
  45. package/sub-skills/plugins/jetbrains-plugin.md +226 -226
  46. package/sub-skills/plugins/vscode-extension.md +204 -204
  47. package/sub-skills/security/security-tools.md +174 -174
  48. package/sub-skills/web/monorepo.md +274 -274
  49. package/sub-skills/web/pwa.md +220 -220
  50. package/sub-skills/web/serverless-edge.md +295 -295
  51. package/sub-skills/web/spa.md +266 -266
  52. package/sub-skills/web/ssr.md +228 -228
  53. package/sub-skills/web/wasm.md +243 -243
@@ -1,164 +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 |
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 |
@@ -1,175 +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 |
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 |