Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms


codenamephp_php (11) Versions 4.1.0

Cookbook to install php

cookbook 'codenamephp_php', '~> 4.1.0'
cookbook 'codenamephp_php', '~> 4.1.0', :supermarket
knife supermarket install codenamephp_php
knife supermarket download codenamephp_php
Quality -%

Chef Cookbook PHP


Cookbook to install php and apache2


Supported Platforms

  • Debian Buster (probably works for previous versions and ubuntu too)


  • Chef 13.0+


Create a wrapper cookbook and add this cookbook to your Berksfile/Metadata.

In your recipie you can use the existing resources, e.g.

codenamephp_php_sury_repository 'sury-php'

codenamephp_php_package 'install php 5.6' do
  package_name "php5.6-cli"

codenamephp_php_package 'install php 7.4' do
  package_name "php7.4-cli"
  additional_packages %w[php7.4-fpm php7.4-curl php7.4-gd]

codenamephp_php_composer 'install composer'

codenamephp_php_xdebug 'install xdebug' do
  php_versions %w[5.6 7.4]
  services %w[cli fpm]



This resource can be used to install composer globally.


  • :install: Install the composer binary (phar) by downloading it from composer homepage and putting it to a folder that is in the path.


  • binary_path: The path where the binary will be placed, default: /usr/bin/composer
  • source: An alias or a source url from where the binary will be downloaded. If the alias is not recognized the source is used as is so it should be a valid url. default: stable, supported aliases:
    • stable
    • preview
    • snapshot
    • 1
    • 2


# Minmal parameters
codenamephp_php_composer 'install composer'

# Custom source and path
codenamephp_php_composer 'install composer' do
  binary_path '/my/custom/executable/path'
  source 'snapshot'


This config can be used to create and manage configurations.


  • enable: Creates or updates the config and enables it by symlinking it for the given services
  • create: Creates or updates the config without enabling it
  • disable: Removes the symlink from the given services but does not delete the config
  • delete: Disables and delete the config


  • cookbook_file: The file from the cookbook that will be used as config
  • php_versions: The php versions the config will be managed for as string array
  • config_name: The name the config will get in the mods-available folder
  • priority: The prefix the symlink will get to determine the sequence the config is loaded in, default: 30 (after default configs which have 20)
  • services: The services the config should be managed for, default: ['cli', 'apache2', 'fpm']
  • cookbook_file_cookbook: The cookbook the cookfile_file will be taken from, default: codenamephp_php


# Minimal config
codenamephp_php_config 'configure xdebug' do
  cookbook_file 'xdebug.ini'
  php_versions %w[5.6 7.2]
  config_name 'xdebug-custom.ini'

# Custom config
codenamephp_php_config 'configure xdebug' do
  cookbook_file 'super-xdebug.ini'
  php_versions %w[5.6 7.2]
  config_name 'super-xdebug-custom.ini'
  priority 40
  services %w[cli]
  cookbook_file_cookbook 'my_cookbook'


This package is used to install php and additional extensions from package


  • install: Installs php and additional extensions


  • package_name: The name of the base package, default: php
  • additional_packages: Additional packages to install, default: []


# Minimal
codenamephp_php_package 'install php'

# Custom package and extensions
codenamephp_php_package 'install php' do
  package_name 'php7.2-cli'
  additional_packages %w[php7.2-json php7.2-xml]

Sury Repository

This resource is used to install the repository from Ondřej Surý to apt.


  • add: Adds the repository to apt sources


  • uri: The uri of the repository, default:
  • repo_name: The name the repository will get, default: sury_php
  • components: The components that will be used, default: main
  • key: The source of the key the repo is signed with, default:


# Minimal
codenamephp_php_sury_repository 'add sury repository'


This resource can be used to install xdebug with a default configuraiton.


  • install: Installs the xdebug extension and configuration for the given php versions
  • remove: Removes the extensionand configuration


  • php_versions: The php versions the config will be managed for as string array
  • package_name: The name of the package that will be installed, default: php-xdebug
  • config_name: The name of the custom config that will be created, default: xdebug-custom.ini
  • config_cookbook_file: The cookbook file that will be used as config, default: xdebug.ini
  • config_cookbook_file_cookbook: The cookbook the cookbook file will be taken from, default: codenamephp_php
  • add_sury_repository: If the sury repository should be added, default: true
  • services: The services the config should be managed for, default: ['apache2', 'fpm']


# Minimal config
codenamephp_php_xdebug 'install xdebug' do
  php_versions %w[5.6 7.2]


This resources installs Phive as global command line tool


  • install: Downloads, verifies and installs the phar
  • uninstall: Removes the phar


  • binary_path: The final path where the binary will be put. Should be in the system path, default: '/usr/bin/phive'
  • binary_temp_path: The path where the phar will be downloaded to prior to verification, default: '/tmp/phive.phar'
  • source: The source from where the phar will be downloaded, default: ''
  • key_uri: The uri from where the key for verification will be downloaded, default: ''
  • key_path: The path to where the key will be downloaded to prior to verifcation, default: '/tmp/phive.phar.asc'
  • install_php_dependencies: Flag if the dependencies (php and some extensions) should be installed, default: true Keep in mind that if you set these to false, you need to install the dependencies yourself or Phive might not work
  • php_version: The desired php version that will be used when installing the dependencies. This is usesd as prefix, e.g. php7.4 -> php7.4-curl' The 'php' is normalized so you can either pass 'phpX.X' or just 'X.X'


# Minimal config
codenamephp_php_phive 'install phive'
# With custom php version
codenamephp_php_phive 'install phive' do
  php_version '8.0'
# Without php dependencies
codenamephp_php_phive 'install phive' do
  install_php_dependencies false


The default cookbook is a No-Op since you want to choose your PHP version and stick to it. Having the default cookbook to install some "random" version could lead to unexpected updates and would cause more breaking changes.

No quality metric results found