> For the complete CircleCI developer hub index, see [llms.txt](https://circleci.com/developer/llms.txt)

# circleci/php

Support for installing the PHP programming language, composer, and packages.


## Commands

### install_composer

Install Composer

| Parameter | Type | Default | Description |
|---|---|---|---|
| `filename` | string | composer | The filename parameter to pass to composer installation. |
| `install_dir` | string | /usr/local/bin | By default, composer will be installed at "/usr/local/bin/composer", use this to override the install directory.
 |
| `install_version` | string |  | By default, composer will install the latest composer version, use this to override the installed version.
 |

### install_packages

Install your composer packages with automated caching and best practices applied.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `app_dir` | string | ~/project | Path to the directory containing your composer.json file. Not needed if composer.json lives in the root. |
| `cache_files_dir` | string | /home/circleci/.composer/cache/files | Absolute path to the file cache folder. This should be inline with "composer global config cache_files_dir --absolute". |
| `cache_key` | string | composer.lock | If this file is updated a new cache bucket will be created. Recommended to use composer.lock. Use composer.json when composer.lock is absent. |
| `cache_version` | string | v1 | Change the default cache version if you need to clear the cache for any reason. |
| `install_flags` | string | --no-interaction --prefer-dist | By default, packages will be installed with "composer install --no-interaction --prefer-dist", use this to override the standard install flags.
 |
| `vendor_dir` | string | vendor | Relative path to the vendor folder. Relative to "app_dir". This should be inline with "composer config vendor_dir". |
| `with_cache` | boolean | true | Enable automatic caching of your dependencies for increased speed. |

### install_php

Install PHP into your Ubuntu or Debian based image.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `extensions` | string |  | Comma separated list of PHP extensions to install. |
| `version` | string | 7.4 | The PHP version. |

## Jobs

### test

Simple drop-in job to test your PHP application automatically.


| Parameter | Type | Default | Description |
|---|---|---|---|
| `app_dir` | string | ~/project | Path to the directory containing your composer.json file. Not needed if composer.json lives in the root. |
| `setup` | steps |  | Provide any optional steps you would like to run prior to installing the composer packages. This is a good place to install global packages. |
| `test_command` | string | test | The name of the script within your composer.json which will run your tests. |
| `version` | string | 7.4 | The `cimg/php` Docker image version tag. |

## Executors

### default

The official CircleCI CIMG PHP Docker image.

| Parameter | Type | Default | Description |
|---|---|---|---|
| `tag` | string | 8.3 | The `cimg/php` Docker image version tag. |

## Examples

### install_composer_packages

Example showing how to install Composer then installing packages for a project.


```yaml
version: '2.1'
orbs:
  php: circleci/php@x.y
jobs:
  install_composer_packages:
    executor: php/default
    steps:
      - checkout
      - php/install_composer:
          install_version: 1.10.16
      - php/install_packages
workflows:
  install:
    jobs:
      - install_composer_packages
```

### install_php_version

Example showing how to install a specific PHP version (7.3). 7.4 is installed by default.


```yaml
version: '2.1'
orbs:
  php: circleci/php@x.y
jobs:
  install_php:
    docker:
      - image: cimg/base:edge
    steps:
      - checkout
      - php/install_php:
          version: '7.3'
workflows:
  install:
    jobs:
      - install_php
```

### test_application

Run composer test on your application in a more opinionated manner.


```yaml
version: '2.1'
orbs:
  php: circleci/php@x.y
workflows:
  test:
    jobs:
      - php/test
```