Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manifest ¶
type Manifest interface {
AllDependencyVersions(depName string) []string
DefaultVersion(depName string) (libbuildpack.Dependency, error)
}
Manifest interface abstracts the buildpack manifest operations needed for options
type Options ¶
type Options struct {
Stack string `json:"STACK"`
LibDir string `json:"LIBDIR"` // Library directory (default: "lib")
WebDir string `json:"WEBDIR"` // Web root directory (default: "htdocs")
WebServer string `json:"WEB_SERVER"` // Web server: "httpd", "nginx", or "none"
PHPVM string `json:"PHP_VM"` // PHP VM type (default: "php")
PHPVersion string `json:"PHP_VERSION,omitempty"` // Specific PHP version to install
PHPDefault string `json:"PHP_DEFAULT,omitempty"` // Default PHP version from manifest
AdminEmail string `json:"ADMIN_EMAIL"` // Admin email for server config (used by httpd)
// STRIP flags control whether to strip the top-level directory when extracting archives.
// These are internal flags used during dependency installation and rarely need to be changed.
// The defaults (false for main packages, true for modules) work for standard buildpack usage.
HTTPDStrip bool `json:"HTTPD_STRIP"` // Strip top dir when extracting httpd (default: false)
HTTPDModulesStrip bool `json:"HTTPD_MODULES_STRIP"` // Strip top dir for httpd modules (default: true)
NginxStrip bool `json:"NGINX_STRIP"` // Strip top dir when extracting nginx (default: false)
PHPStrip bool `json:"PHP_STRIP"` // Strip top dir when extracting php (default: false)
PHPModulesStrip bool `json:"PHP_MODULES_STRIP"` // Strip top dir for php modules (default: true)
PHPModules []string `json:"PHP_MODULES"` // PHP modules to load
PHPExtensions []string `json:"PHP_EXTENSIONS"` // PHP extensions to enable
ZendExtensions []string `json:"ZEND_EXTENSIONS"` // Zend extensions to enable
ComposerVendorDir string `json:"COMPOSER_VENDOR_DIR,omitempty"` // Custom composer vendor directory
ComposerInstallOptions []string `json:"COMPOSER_INSTALL_OPTIONS,omitempty"` // Additional composer install options
// Additional preprocess commands to run before app starts
// Supports: string, []string, or [][]string formats (v4.x compatibility)
AdditionalPreprocessCmds interface{} `json:"ADDITIONAL_PREPROCESS_CMDS,omitempty"`
// Custom start command for standalone PHP applications (when WEB_SERVER=none)
// If not set, auto-detects: app.php, main.php, run.php, start.php
AppStartCmd string `json:"APP_START_CMD,omitempty"`
// Internal flags
OptionsJSONHasPHPExtensions bool `json:"OPTIONS_JSON_HAS_PHP_EXTENSIONS,omitempty"`
// Dynamic PHP version tracking (e.g., PHP_81_LATEST, PHP_82_LATEST)
PHPVersions map[string]string `json:"-"`
}
Options represents the merged buildpack configuration from defaults/options.json and .bp-config/options.json
func LoadOptions ¶
func LoadOptions(bpDir, buildDir string, manifest Manifest, logger *libbuildpack.Logger) (*Options, error)
LoadOptions loads and merges options from defaults/options.json and .bp-config/options.json
func (*Options) FindStandaloneApp ¶
FindStandaloneApp returns the PHP file to run for standalone applications (WEB_SERVER=none). If APP_START_CMD is set, returns that. Otherwise auto-detects in order:
- app.php
- main.php
- run.php
- start.php
Returns empty string if no standalone app found.
func (*Options) GetPHPVersion ¶
GetPHPVersion returns the PHP version to use, either from user config or default Resolves placeholders like {PHP_83_LATEST} to actual versions
func (*Options) GetPreprocessCommands ¶
GetPreprocessCommands returns the list of preprocess commands to run before app starts. Supports multiple formats for v4.x compatibility:
- string: "source $HOME/scripts/bootstrap.sh"
- []string: ["env", "run_something"]
- [][]string: [["echo", "Hello"], ["run", "script"]]
Returns a list of shell command strings ready to execute.