doc/php: Add example for installing composer with extra extensions
This commit is contained in:
		
							parent
							
								
									d2cb49c248
								
							
						
					
					
						commit
						e31a68ddba
					
				@ -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
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user