summary refs log tree commit diff
path: root/doc/languages-frameworks/php.section.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/languages-frameworks/php.section.md')
-rw-r--r--doc/languages-frameworks/php.section.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/languages-frameworks/php.section.md b/doc/languages-frameworks/php.section.md
index 763beeb5935..5977363323f 100644
--- a/doc/languages-frameworks/php.section.md
+++ b/doc/languages-frameworks/php.section.md
@@ -135,3 +135,21 @@ Example of building `composer` with additional extensions:
   enabled ++ (with all; [ imagick redis ]))
 ).packages.composer
 ```
+
+### Overriding PHP packages {#ssec-php-user-guide-overriding-packages}
+
+`php-packages.nix` form a scope, allowing us to override the packages defined within. For example, to apply a patch to a `mysqlnd` extension, you can simply pass an overlay-style function to `php`’s `packageOverrides` argument:
+
+```nix
+php.override {
+  packageOverrides = final: prev: {
+    extensions = prev.extensions // {
+      mysqlnd = prev.extensions.mysqlnd.overrideAttrs (attrs: {
+        patches = attrs.patches or [] ++ [
+          …
+        ];
+      });
+    };
+  };
+}
+```