GithubHelp home page GithubHelp logo

sample-functions-php-numberstowords's Introduction

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.

sample-functions-php-numberstowords's People

Contributors

beardicus avatar joshuaauerbachwatson avatar logwolvy avatar pulkit-khullar avatar rabbah avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.