Skip to content

Latest commit

 

History

History

php8

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

PHP8 Template

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

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

Usage:

faas-cli new my-function --lang php8

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

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

Extra Extensions

If you need to install PHP extensions, check out the following example, which you could use in your php-extension.sh 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": {"bitbucket.org": {"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.