Skip to content

Commit

Permalink
Merge pull request #259 from humanmade/backport-256-to-v6-branch
Browse files Browse the repository at this point in the history
[Backport v6-branch] Make PHP version configurable
  • Loading branch information
Chris Reynolds authored Jan 19, 2021
2 parents b28c86e + 4d1d19c commit 931feaa
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
21 changes: 21 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,24 @@ The subdomain used for the project can be configured via the `modules.local-serv
* `composer server db info` - Print MySQL connection details.
* `composer server db sequel` - Opens a connection to the database in [Sequel Pro](https://sequelpro.com).
* `composer server import-uploads` - Syncs files from `content/uploads` to the s3 container.


## Configuring the PHP Version

Local Server currently defaults to PHP 7.2. In advance of the PHP 7.4 upgrade coming soon for all Altis sites you can opt-in to using PHP 7.4 for your local environment ahead of time for testing purposes.

To do this add the following your configuration:

```json
{
"extra": {
"altis": {
"modules": {
"local-server": {
"php": "7.4"
}
}
}
}
}
```
8 changes: 7 additions & 1 deletion inc/composer/class-docker-compose-generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ protected function get_php_reusable() : array {
'condition' => 'service_started',
],
],
'image' => 'humanmade/altis-local-server-php:4.0.0-alpha2-dev',
'image' => 'humanmade/altis-local-server-php:3.4.0-dev',
'links' => [
'db:db-read-replica',
's3:s3.localhost',
Expand Down Expand Up @@ -148,6 +148,11 @@ protected function get_php_reusable() : array {
],
];

// Opt in to PHP 7.4 usage.
if ( $this->get_config()['php'] === '7.4' ) {
$services['image'] = 'humanmade/altis-local-server-php:4.0.0-alpha2-dev';
}

if ( $this->get_config()['elasticsearch'] ) {
$services['depends_on']['elasticsearch'] = [
'condition' => 'service_healthy',
Expand Down Expand Up @@ -643,6 +648,7 @@ protected function get_config( $module = 'local-server' ) : array {

$config = ( $composer_json['extra']['altis']['modules'][ $module ] ?? [] );
$defaults = [
'php' => '7.2',
'analytics' => true,
'cavalcade' => true,
'elasticsearch' => true,
Expand Down

0 comments on commit 931feaa

Please sign in to comment.