Skip to content

digitalocean/sample-functions-php-numberstowords

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Sample Function: PHP Numbers to Words

Introduction

This repository contains a sample function written in PHP. You can deploy it on DigitalOcean's App Platform as a Serverless Function component or as a standalone Function. Documentation is available at https://docs.digitalocean.com/products/functions.

Requirements

Deploying the Function

# clone this repo
git clone [email protected]:digitalocean/sample-functions-php-numberstowords.git
# deploy the project, using a remote build so that compiled executable matched runtime environment
doctl serverless deploy sample-functions-php-numberstowords --remote-build

The output from the deploy command will resemble the following.

Deploying 'sample-functions-php-numberstowords'
  to namespace 'fn-...'
  on host '...'
Submitted function 'main/n2w' for remote building and deployment in runtime php:default (id: ...)
Deployment status recorded in 'sample-functions-php-numberstowords/.deployed'

Deployed functions ('doctl sls fn get <funcName> --url' for URL):
  - main/n2w

Using the Function

doctl serverless functions invoke main/n2w -p number:123
{
  "body": "one hundred and twenty-three"
}

You can use that API directly in your browser, with curl or with an API platform such as Postman. Parameters may be passed as query parameters, or as JSON body. Here are some examples using curl.

curl `doctl sls fn get main/n2w --url`?number=456
curl -H 'Content-Type: application/json' -d '{"number":"789"}' `doctl sls fn get main/n2w --url`

Project File Structure

Learn More

You can learn more about Functions by reading the Functions Documentation.

About

No description, website, or topics provided.

Resources

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •