phpdist

package module
v0.0.196 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

README

PHP Dist Cloud Native Buildpack

The PHP Dist CNB provides the PHP binary distribution. The buildpack installs the PHP binary distribution onto the $PATH which makes it available for subsequent buildpacks. These buildpacks can then use that distribution to run PHP tooling. The PHP Web CNB is an example of a buildpack that utilizes the PHP binary.

Integration

The PHP Dist CNB provides php as a dependency. Downstream buildpacks, like PHP Composer CNB can require the php dependency by generating a Build Plan TOML file that looks like the following:

[[requires]]

  # The name of the PHP dependency is "php". This value is considered
  # part of the public API for the buildpack and will not change without a plan
  # for deprecation.
  name = "php"

  # The version of the PHP dependency is not required. In the case it
  # is not specified, the buildpack will provide the default version, which can
  # be seen in the buildpack.toml file.
  # If you wish to request a specific version, the buildpack supports
  # specifying a semver constraint in the form of "7.*", "7.4.*", or even
  # "7.4.4".
  version = "7.4.4"

  # The PHP buildpack supports some non-required metadata options.
  [requires.metadata]

    # Setting the build flag to true will ensure that the PHP
    # depdendency is available on the $PATH for subsequent buildpacks during
    # their build phase. If you are writing a buildpack that needs to run PHP
    # during its build process, this flag should be set to true.
    build = true

    # Setting the launch flag to true will ensure that the PHP
    # dependency is available on the $PATH for the running application. If you are
    # writing an application that needs to run PHP at runtime, this flag should
    # be set to true.
    launch = true

Usage

To package this buildpack for consumption:

$ ./scripts/package.sh

This builds the buildpack's Go source using GOOS=linux by default. You can supply another value as the first argument to package.sh.

License

This buildpack is released under version 2.0 of the Apache License.

buildpack.yml Configurations

In order to specify a particular version of php you can provide an optional buildpack.yml in the root of the application directory.

php:
  # this allows you to specify a version constraint for the `php` depdendency
  # any valid semver constaints (e.g. 7.*) are also acceptable
  version: 7.2.*

Documentation

Index

Constants

View Source
const (
	DepKey = "dependency-sha"
)

Variables

This section is empty.

Functions

func Build

func Build(entries EntryResolver,
	dependencies DependencyManager,
	environment EnvironmentConfiguration,
	planRefinery BuildPlanRefinery,
	logger LogEmitter,
	clock chronos.Clock) packit.BuildFunc

func Detect

func Detect(buildpackYMLParser VersionParser) packit.DetectFunc

Types

type BuildPlanMetadata

type BuildPlanMetadata struct {
	VersionSource string `toml:"version-source"`
}

type BuildPlanRefinery

type BuildPlanRefinery interface {
	BillOfMaterials(dependency postal.Dependency) packit.BuildpackPlan
}

type BuildpackYMLParser

type BuildpackYMLParser struct{}

func NewBuildpackYMLParser

func NewBuildpackYMLParser() BuildpackYMLParser

func (BuildpackYMLParser) Parse

func (p BuildpackYMLParser) Parse(path string) (Config, error)

func (BuildpackYMLParser) ParseVersion

func (p BuildpackYMLParser) ParseVersion(path string) (string, error)

type Config

type Config struct {
	Version string `yaml:"version"`
}

type DependencyManager

type DependencyManager interface {
	Resolve(path, id, version, stack string) (postal.Dependency, error)
	Install(dependency postal.Dependency, cnbPath, layerPath string) error
}

type EntryResolver

type EntryResolver interface {
	Resolve([]packit.BuildpackPlanEntry) packit.BuildpackPlanEntry
}

type Environment

type Environment struct {
	// contains filtered or unexported fields
}

func NewEnvironment

func NewEnvironment(logger LogEmitter) Environment

func (Environment) Configure

func (e Environment) Configure(layer packit.Layer) error

type EnvironmentConfiguration

type EnvironmentConfiguration interface {
	Configure(layer packit.Layer) error
}

type LogEmitter

type LogEmitter struct {
	scribe.Logger
}

func NewLogEmitter

func NewLogEmitter(output io.Writer) LogEmitter

func (LogEmitter) Candidates

func (e LogEmitter) Candidates(entries []packit.BuildpackPlanEntry)

func (LogEmitter) Environment

func (e LogEmitter) Environment(environment packit.Environment)

func (LogEmitter) SelectedDependency

func (e LogEmitter) SelectedDependency(entry packit.BuildpackPlanEntry, version string)

func (LogEmitter) Title

func (e LogEmitter) Title(info packit.BuildpackInfo)

type PlanEntryResolver

type PlanEntryResolver struct {
	// contains filtered or unexported fields
}

func NewPlanEntryResolver

func NewPlanEntryResolver(logger LogEmitter) PlanEntryResolver

func (PlanEntryResolver) Resolve

type PlanRefinery

type PlanRefinery struct{}

func NewPlanRefinery

func NewPlanRefinery() PlanRefinery

func (PlanRefinery) BillOfMaterials added in v0.0.189

func (r PlanRefinery) BillOfMaterials(dependency postal.Dependency) packit.BuildpackPlan

type VersionParser

type VersionParser interface {
	ParseVersion(path string) (version string, err error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL