From e31a68ddba141e11f1569ae4d2cd0fb1a87fd5e4 Mon Sep 17 00:00:00 2001 From: Elis Hirwing Date: Fri, 1 May 2020 09:33:04 +0200 Subject: doc/php: Add example for installing composer with extra extensions --- doc/languages-frameworks/php.section.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'doc') diff --git a/doc/languages-frameworks/php.section.md b/doc/languages-frameworks/php.section.md index 30c05b3b6143..763beeb59358 100644 --- a/doc/languages-frameworks/php.section.md +++ b/doc/languages-frameworks/php.section.md @@ -62,7 +62,7 @@ To build your list of extensions from the ground up, you can simply ignore `enabled`: ```nix -php.withExtensions ({ all, ... }: with all; [ opcache imagick ]) +php.withExtensions ({ all, ... }: with all; [ imagick opcache ]) ``` `php.withExtensions` provides extensions by wrapping a minimal php @@ -94,7 +94,7 @@ follows: ```nix let - myPhp = php.withExtensions ({ all, ... }: with all; [ opcache imagick ]); + myPhp = php.withExtensions ({ all, ... }: with all; [ imagick opcache ]); in { services.phpfpm.pools."foo".phpPackage = myPhp; }; @@ -119,3 +119,19 @@ with the extensions `imagick` and `opcache` enabled: ```sh nix-shell -p 'php.withExtensions ({ all, ... }: with all; [ imagick opcache ])' ``` + +### Installing PHP packages with extensions {#ssec-php-user-guide-installing-packages-with-extensions} + +All interactive tools use the PHP package you get them from, so all +packages at `php.packages.*` use the `php` package with its default +extensions. Sometimes this default set of extensions isn't enough and +you may want to extend it. A common case of this is the `composer` +package: a project may depend on certain extensions and `composer` +won't work with that project unless those extensions are loaded. + +Example of building `composer` with additional extensions: +```nix +(php.withExtensions ({ all, enabled }: + enabled ++ (with all; [ imagick redis ])) +).packages.composer +``` -- cgit 1.4.1