Documentation ¶
Index ¶
- Constants
- Variables
- func Build(dependencies DependencyManager, files FileManager, ...) packit.BuildFunc
- func Detect() packit.DetectFunc
- type BuildPlanMetadata
- type DependencyManager
- type Environment
- type EnvironmentConfiguration
- type FileManager
- type PHPFileManager
- type PhpIniConfig
- type SBOMGenerator
Constants ¶
const ( DepKey = "dependency-sha" PHPDependency = "php" UserProvidedPath = ".php.ini.d" )
Variables ¶
var EntryPriorities = []interface{}{
"BP_PHP_VERSION",
"composer.lock",
"composer.json",
"default-versions",
}
Functions ¶
func Build ¶
func Build(dependencies DependencyManager, files FileManager, environment EnvironmentConfiguration, sbomGenerator SBOMGenerator, logger scribe.Emitter, clock chronos.Clock) packit.BuildFunc
Build will return a packit.BuildFunc that will be invoked during the build phase of the buildpack lifecycle.
Build will find the right php dependency to install, install it in a layer, and generate a Bill-of-Materials. On rebuilds, it reuses the cached dependency if the SHA256 of the requested version matches the SHA256 of the cached version. Build also sets up a default php.ini configuration.
Types ¶
type BuildPlanMetadata ¶
type BuildPlanMetadata struct { Version string `toml:"version"` VersionSource string `toml:"version-source"` }
BuildPlanMetadata is the buildpack specific data included in build plan requirements.
type DependencyManager ¶
type DependencyManager interface { Resolve(path, id, version, stack string) (postal.Dependency, error) Deliver(dependency postal.Dependency, cnbPath, layerPath, platformPath string) error GenerateBillOfMaterials(dependencies ...postal.Dependency) []packit.BOMEntry }
DependencyManager defines the interface for picking the best matching dependency, installing it, and generating a BOM.
type Environment ¶
type Environment struct { }
Environment sets build- and launch-time environment variables to properly install and configure PHP.
func NewEnvironment ¶
func NewEnvironment() Environment
func (Environment) Configure ¶
func (e Environment) Configure(layer packit.Layer, extensionsDir string, defaultIniPath string, iniScanDirs []string) error
Configure sets build- and launch-time environment variables on the layer passed as input. Proper values for the environment variables are determined by the layer path, and the other paths provided as inputs. See PHP documentation for an explanation of the environment variables' significance.
type EnvironmentConfiguration ¶
type EnvironmentConfiguration interface {
Configure(layer packit.Layer, extensionsDir, defaultIni string, scanDirs []string) error
}
EnvironmentConfiguration defines the interface for setting build- and launch-time environment variables on the layer.
type FileManager ¶ added in v0.6.0
type FileManager interface { FindExtensions(layerRoot string) (string, error) WriteConfig(layerRoot, cnbPath string, data PhpIniConfig) (defaultConfig string, buildpackConfig string, err error) }
FileManager defines the interface for manipulating files in the PHP installation in the build container.
type PHPFileManager ¶ added in v0.6.0
type PHPFileManager struct{}
PHPFileManager finds, copies, and creates files necessary for a proper PHP installation.
func NewPHPFileManager ¶ added in v0.6.0
func NewPHPFileManager() PHPFileManager
func (PHPFileManager) FindExtensions ¶ added in v0.6.0
func (f PHPFileManager) FindExtensions(layerRoot string) (string, error)
FindExtensions checks a path relative to the layer passed as input where it expects extensions to be pre-installed. It fails if a directory in the expected location does not exist.
func (PHPFileManager) WriteConfig ¶ added in v0.6.0
func (f PHPFileManager) WriteConfig(layerRoot, cnbPath string, data PhpIniConfig) (string, string, error)
WriteConfig generates a default PHP configuration and stores the resulting *.ini files in the layer provided as input.
type PhpIniConfig ¶ added in v0.6.0
type PhpIniConfig struct { IncludePath string // include_path = "{{.PhpHome}}/lib/php:{{.AppRoot}}/{{.LibDirectory}}" ExtensionDir string // extension_dir = "{{.PhpHome}}/lib/php/extensions/no-debug-non-zts-{{.PhpAPI}}" Extensions []string ZendExtensions []string }
PHPIniConfig represents the data that will be inserted in a templated php.ini file.