Skip to main content

PHP Example

TeleCMI webhooks implementation in PHP. Use our simple php web server to test your webhooks and live events locally for development purpose.

Install

Follow the below installation instructions

Prerequisites

Prerequisites for php web server.

  • git (>= 2.20.1 required)
  • php (>= 7.3.11 required)
  • composer (>= 1.9.0 required)

Clone the repository

Use command git clone to clone the php webserver from our TeleCMI github repository.

git clone https://github.com/telecmi/telecmi_example_php.git

Change the directory to your project directory

 cd telecmi_example_php

Install required package using composer

composer install

Run

Run your php server using the below command

php -S localhost:5000 index.php

Now you can able to test our webhooks and live events, from your local server. To expose your local web server to the internet use ngrok.

You can create a secure HTTP tunnel by providing the port number on which your web server is running. For example, your web server is running on port number 5000. you can launch your HTTP tunnel with the following command line.

./ngrok http 5000

After exposing your local webserver to the internet using ngrok you will get the following output.

Authentication

Now you can get your dynamic URL from the above output. To configure webhooks and live events, paste your dynamic URL with correct path in webhooks section.

Note
Each time you start up the Ngrok tunnel, you're likely to get a new URL so don't forget to update the new url in the dashboard.