You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add 80K of comprehensive documentation covering architecture, features, migration,
and service binding patterns for both end users and developers/maintainers.
Documentation Structure:
- docs/USER_GUIDE.md (15K, 865 lines) - Complete end-user guide
- docs/FEATURES.md (11K, 696 lines) - Developer reference with test coverage
- docs/BUILDPACK_COMPARISON.md (12K) - Cross-buildpack architectural analysis
- docs/VCAP_SERVICES_USAGE.md (12K) - Service binding patterns and best practices
- docs/REWRITE_MIGRATION.md (27K) - v4.x to v5.x migration guide
- docs/README.md (7K) - Navigation hub with best practices
USER_GUIDE.md (For End Users):
- Getting started (deploy in 2 commands)
- Web server configuration (Apache, Nginx, FPM-only)
- PHP configuration (versions, ini files, FPM pools)
- PHP extensions installation
- Composer and dependency management
- APM integration (NewRelic, AppDynamics, Dynatrace)
- Session storage (Redis, Memcached)
- Framework guides (Laravel, CakePHP, Symfony, Laminas)
- Advanced features (multi-buildpack, preprocess commands)
- Troubleshooting section
FEATURES.md (For Developers/Maintainers):
- 30+ features with explicit integration test references
- Test locations (file:line numbers)
- Fixture paths for each feature
- Implementation details and code snippets
- Test coverage analysis matrix
- Identification of features needing explicit tests
- Cross-references to integration tests
BUILDPACK_COMPARISON.md:
- Proves PHP v5.x follows same patterns as Go, Java, Ruby, Python buildpacks
- Documents VCAP_SERVICES availability during staging
- Explains why v4.x runtime rewrite was PHP-unique, not a CF standard
- Shows alignment with Cloud Foundry buildpack ecosystem
VCAP_SERVICES_USAGE.md:
- Clarifies VCAP_SERVICES IS available during staging (for extensions and Go code)
- Documents that @{VCAP_SERVICES} config file placeholders are not supported
- Provides service binding patterns and examples
- Migration strategies from v4.x
- Best practices and anti-patterns
REWRITE_MIGRATION.md:
- Comprehensive v4.x to v5.x migration guide
- Breaking changes in rewrite system
- Placeholder syntax changes
- User-provided config handling
- Corrects misconceptions about VCAP_SERVICES availability
Key Documentation Insights:
- VCAP_SERVICES IS available during staging in Go code (not just runtime)
- PHP v5.x aligns with all other CF buildpacks (Go, Java, Ruby, Python)
- v4.x runtime rewrite was PHP-unique, removed for CF standards alignment
- 95%+ test coverage verification for documented features
- Separate docs for end users vs developers/maintainers
The documentation demonstrates comprehensive feature coverage and provides
clear guidance for both buildpack users and maintainers.
These are standard environment variables expanded at **runtime**:
177
+
178
+
- `${PORT}` - HTTP port assigned by Cloud Foundry (dynamic)
179
+
- `${TMPDIR}` - Temporary directory (can be customized)
180
+
- `${HOME}` - Application directory
181
+
- `${HTTPD_SERVER_ADMIN}` - Apache admin email
182
+
183
+
**Supported by:**
184
+
- **Apache HTTPD** - Native variable interpolation for any `${VAR}`
185
+
- **Bash scripts** - Standard shell expansion for any `${VAR}`
186
+
- **Nginx/PHP configs** - Only `${PORT}` and `${TMPDIR}` via sed replacement
187
+
188
+
**Example** (httpd.conf):
189
+
```apache
190
+
Listen ${PORT}# Expanded by Apache at runtime
191
+
ServerRoot "${HOME}/httpd" # Expanded by Apache at runtime
192
+
DocumentRoot "${HOME}/htdocs" # Expanded by Apache at runtime
193
+
```
194
+
195
+
**Note:** Custom placeholders are **not supported**. To use custom configuration values, either:
196
+
- Use environment variables with `${VAR}` syntax (works with Apache/bash)
197
+
- Set values directly in your code instead of using placeholders
198
+
142
199
### Extensions
143
200
144
201
The buildpack includes several built-in extensions written in Go:
@@ -175,9 +232,108 @@ type Extension interface {
175
232
176
233
For examples, see the built-in extensions in`src/php/extensions/`.
177
234
178
-
**Note:** Custom user extensions from `.extensions/` directory are not currently supported in the Go-based buildpack. This feature may be added in a future release.
235
+
### User Extensions
236
+
237
+
The buildpack supports user-defined extensions through the `.extensions/` directory. This allows you to add custom startup commands, environment variables, and services without modifying the buildpack itself.
238
+
239
+
#### Creating a User Extension
240
+
241
+
Create a directory `.extensions/<name>/`in your application with an `extension.json` file:
242
+
243
+
```
244
+
myapp/
245
+
├── .extensions/
246
+
│ └── myext/
247
+
│ └── extension.json
248
+
├── index.php
249
+
└── .bp-config/
250
+
└── options.json
251
+
```
252
+
253
+
#### extension.json Format
254
+
255
+
```json
256
+
{
257
+
"name": "my-custom-extension",
258
+
"preprocess_commands": [
259
+
"echo 'Running setup'",
260
+
["./bin/setup.sh", "arg1", "arg2"]
261
+
],
262
+
"service_commands": {
263
+
"worker": "php worker.php --daemon"
264
+
},
265
+
"service_environment": {
266
+
"MY_VAR": "my_value",
267
+
"ANOTHER_VAR": "another_value"
268
+
}
269
+
}
270
+
```
271
+
272
+
**Fields:**
273
+
274
+
- `name` - Extension identifier (defaults to directory name)
275
+
- `preprocess_commands` - Commands to run at container startup before PHP-FPM starts. Each command can be a string or array of arguments.
0 commit comments