Skip to content

Simplify php_extensions_custom syntax to accept short names #1666

Description

@retlehs

Adding a custom PHP extension today requires verbose, version-templated syntax in group_vars/all/main.yml:

php_extensions_custom:
  "php{{ php_version }}-soap": "{{ apt_package_state }}"

Proposal

Allow php_extensions_custom to be a plain list of short names:

php_extensions_custom:
  - soap
  - gd
  - imap

Trellis would internally expand each entry to "php{{ php_version }}-{{ item }}": "{{ apt_package_state }}" before merging into php_extensions_default.

Backwards compatibility

Keep accepting the existing dict form so no one's playbook breaks:

# still valid
php_extensions_custom:
  "php{{ php_version }}-soap": "{{ apt_package_state }}"

The verify task in roles/common/tasks/main.yml would need to allow either a list of strings or a dict, and the merge in roles/php/defaults/main.yml (php_extensions: "{{ php_extensions_default | combine(php_extensions_custom) }}") would need a normalization step ahead of the combine.

Optional stretch

Same treatment for php_extensions_default overrides in roles/php/vars/<version>.yml, so version-specific files can also use short names.

Ref 5f398b2
Ref https://discourse.roots.io/t/php-extensions-custom-must-be-formatted-as-dicts/11039/

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions