# Defined Type: php::extension

Defined in:
  manifests/extension.pp

## Overview

Install a PHP extension package

=== Parameters

[ensure] The ensure of the package to install Could be "latest", "installed" or a pinned version

[package_prefix] Prefix to prepend to the package name for the package provider

[provider] The provider used to install the package Could be "pecl", "apt", "dpkg" or any other OS package provider If set to "none", no package will be installed

[source] The source to install the extension from. Possible values depend on the provider used

[so_name] The DSO name of the package (e.g. opcache for zendopcache)

[ini_prefix] An optional filename prefix for the settings file of the extension

[php_api_version] This parameter is used to build the full path to the extension directory for zend_extension in PHP < 5.5 (e.g. 20100525)

[header_packages] System packages dependencies to install for extensions (e.g. for memcached libmemcached-dev on Debian)

[compiler_packages] System packages dependencies to install for compiling extensions (e.g. build-essential on Debian)

[zend] Boolean parameter, whether to load extension as zend_extension. Defaults to false.

[settings] Nested hash of global config parameters for php.ini

[settings_prefix] Boolean/String parameter, whether to prefix all setting keys with the extension name or specified name. Defaults to false.

[sapi] String parameter, whether to specify ALL sapi or a specific sapi. Defaults to ALL.

[responsefile] File containing answers for interactive extension setup. Supported providers: pear, pecl.

[install_options] Array of String or Hash options to pass to the provider.

Parameters:

- ensure (`String`) (defaults to: `'installed'`)
- provider (`Optional[Php::Provider]`) (defaults to: `undef`)
- source (`Optional[String]`) (defaults to: `undef`)
- so_name (`Optional[String]`) (defaults to: `downcase($name)`)
- ini_prefix (`Optional[String]`) (defaults to: `undef`)
- php_api_version (`Optional[String]`) (defaults to: `undef`)
- package_prefix (`String`) (defaults to: `$::php::package_prefix`)
- zend (`Boolean`) (defaults to: `false`)
- settings (`Hash`) (defaults to: `{}`)
- sapi (`Php::Sapi`) (defaults to: `'ALL'`)
- settings_prefix (`Variant[Boolean, String]`) (defaults to: `false`)
- responsefile (`Optional[Stdlib::AbsolutePath]`) (defaults to: `undef`)
- header_packages (`Variant[String, Array[String]]`) (defaults to: `[]`)
- compiler_packages (`Variant[String, Array[String]]`) (defaults to: `$::php::params::compiler_packages`)
- install_options (`Php::InstallOptions`) (defaults to: `undef`)

    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    # File 'manifests/extension.pp', line 61

    define php::extension (
      String           $ensure                          = 'installed',
      Optional[Php::Provider] $provider                 = undef,
      Optional[String] $source                          = undef,
      Optional[String] $so_name                         = downcase($name),
      Optional[String] $ini_prefix                      = undef,
      Optional[String] $php_api_version                 = undef,
      String           $package_prefix                  = $::php::package_prefix,
      Boolean          $zend                            = false,
      Hash             $settings                        = {},
      Php::Sapi        $sapi                            = 'ALL',
      Variant[Boolean, String]       $settings_prefix   = false,
      Optional[Stdlib::AbsolutePath] $responsefile      = undef,
      Variant[String, Array[String]] $header_packages   = [],
      Variant[String, Array[String]] $compiler_packages = $::php::params::compiler_packages,
      Php::InstallOptions $install_options              = undef,
    ) {

      if ! defined(Class['php']) {
        warning('php::extension is private')
      }

      php::extension::install { $title:
        ensure            => $ensure,
        provider          => $provider,
        source            => $source,
        responsefile      => $responsefile,
        package_prefix    => $package_prefix,
        header_packages   => $header_packages,
        compiler_packages => $compiler_packages,
        install_options   => $install_options,
      }

      # PEAR packages don't require any further configuration, they just need to "be there".
      if $provider != 'pear' {
        php::extension::config { $title:
          ensure          => $ensure,
          provider        => $provider,
          so_name         => $so_name,
          ini_prefix      => $ini_prefix,
          php_api_version => $php_api_version,
          zend            => $zend,
          settings        => $settings,
          settings_prefix => $settings_prefix,
          sapi            => $sapi,
          subscribe       => Php::Extension::Install[$title],
        }
      }
    }