Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

PHP7 Template

Templates are built using the latest minor version of the major release.

Modules (by default)
Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, ftp, hash, iconv, json, mbstring, SPL, PDO, pdo_sqlite, session, posix, readline, Reflection, standard, SimpleXML, Phar, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, sodium


faas-cli new my-function --lang php7

You will find in the newly created directory my-function:

  • src/Handler.php : entrypoint
  • : is for installing PHP extensions if needed
  • composer.json : is for dependency management

Extra Extensions

If you need to install Phalcon for example, check out the following sample which you could use in your functions src/ file;

You can also refer to the PHP Docker image documentation for additional instructions on the installation and configuration of extensions

Private Composer Auth

In some cases, you may need to use private composer repositories - using the faas-cli you can pass in a build argument during build, for example;

faas-cli build -f ./functions.yml \
  --build-arg COMPOSER_AUTH='{"bitbucket-oauth": {"": {"consumer-key": "xxxxxxxx","consumer-secret": "xxxxxxx"}}}'

See more information here.

That way you can pass in tokens for Composer, if necessary, GitHub tokens to get around rate-limit issues.