Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PHP 7.3 runtime #4182

Merged
merged 3 commits into from Dec 17, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 15 additions & 1 deletion ansible/files/runtimes.json
Expand Up @@ -194,7 +194,7 @@
},
{
"kind": "php:7.2",
"default": true,
"default": false,
"deprecated": false,
"image": {
"prefix": "openwhisk",
Expand All @@ -205,6 +205,20 @@
"attachmentName": "codefile",
"attachmentType": "text/plain"
}
},
{
"kind": "php:7.3",
"default": true,
"deprecated": false,
"image": {
"prefix": "openwhisk",
"name": "action-php-v7.3",
"tag": "latest"
},
"attached": {
"attachmentName": "codefile",
"attachmentType": "text/plain"
}
}
],
"ruby": [
Expand Down
1 change: 1 addition & 0 deletions core/controller/src/main/resources/apiv1swagger.json
Expand Up @@ -1895,6 +1895,7 @@
"nodejs:default",
"php:7.1",
"php:7.2",
"php:7.3",
"python:2",
"python:3",
"python:default",
Expand Down
2 changes: 1 addition & 1 deletion docs/actions-new.md
Expand Up @@ -64,7 +64,7 @@ additional rqeuirements and best practices:
Actions when created specify the desired runtime for the function via a property called "kind".
When using the `wsk` CLI, this is specified as `--kind <runtime-kind>`. The value is a typically
a string describing the language (e.g., `nodejs`) followed by a colon and the version for the runtime
as in `nodejs:8` or `php:7.2`.
as in `nodejs:8` or `php:7.3`.

The manifest is a map of runtime family names to an array of specific kinds. The details of the
schema are found in the [Exec Manifest](../common/scala/src/main/scala/org/apache/openwhisk/core/entity/ExecManifest.scala).
Expand Down
23 changes: 16 additions & 7 deletions docs/actions-php.md
Expand Up @@ -23,10 +23,15 @@ The process of creating PHP actions is similar to that of [other actions](action
The following sections guide you through creating and invoking a single PHP action,
and demonstrate how to bundle multiple PHP files and third party dependencies.

PHP actions are executed using PHP 7.2.6, with PHP 7.1.18 also available.
To use the PHP 7.2 runtime, specify the `wsk` CLI parameter `--kind php:7.2` when creating or updating an action.
This is the default when creating an action with file that has a `.php` extension.
You can use `-- kind php:7.1 to use the PHP 7.1 runtime.
PHP actions are executed using PHP 7.3. PHP 7.2 & PHP 7.1 are also available. The specific
version of PHP is listed in the CHANGELOG files in the [PHP runtime repository](https://github.com/apache/incubator-openwhisk-runtime-php).

To use a PHP runtime, specify the `wsk` CLI parameter `--kind` when creating or
updating an action. The available PHP kinds are:

* PHP 7.3: `--kind php:7.3`
* PHP 7.2: `--kind php:7.2`
* PHP 7.1: `--kind php:7.1`

An action is simply a top-level PHP function. For example, create a file called `hello.php`
with the following source code:
Expand All @@ -53,7 +58,7 @@ wsk action create helloPHP hello.php
```

The CLI automatically infers the type of the action from the source file extension.
For `.php` source files, the action runs using a PHP 7.2 runtime.
For `.php` source files, the action runs using a PHP 7.3 runtime.

Action invocation is the same for PHP actions as it is for [any other action](actions.md#the-basics).

Expand Down Expand Up @@ -101,8 +106,12 @@ The PHP runtime will automatically include Composer's autoloader for you, so you
use the dependencies in your action code. Note that if you don't include your own `vendor` folder,
then the runtime will include one for you with the following Composer packages:

- guzzlehttp/guzzle v6.3.3
- ramsey/uuid v3.7.3
- guzzlehttp/guzzle
- ramsey/uuid

The specific versions of these packages depends on the PHP runtime in use and is listed in the
CHANGELOG files in the [PHP runtime repository](https://github.com/apache/incubator-openwhisk-runtime-php).


## Built-in PHP extensions

Expand Down
9 changes: 9 additions & 0 deletions tests/dat/actions/unicode.tests/php-7.3.txt
@@ -0,0 +1,9 @@
<?php
// Licensed to the Apache Software Foundation (ASF) under one or more contributor
// license agreements; and to You under the Apache License, Version 2.0.

function main(array $args) : array {
$str = $args['delimiter'] . " ☃ " . $args['delimiter'];
echo $str . "\n";
return ["winter" => $str];
}