PHPackages                             winegard/winegard-alexa-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. winegard/winegard-alexa-php

ActiveLibrary[API Development](/categories/api)

winegard/winegard-alexa-php
===========================

Php library for amazon echo (alexa) skill development.

0.2.5(2y ago)0165MITPHPPHP &gt;=7.0

Since Mar 8Pushed 2y agoCompare

[ Source](https://github.com/Winegard/winegard-alexa-php)[ Packagist](https://packagist.org/packages/winegard/winegard-alexa-php)[ RSS](/packages/winegard-winegard-alexa-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (3)Versions (45)Used By (0)

[![Build Status](https://camo.githubusercontent.com/e7cb148d0630c189be9a1b11c4682bf0b22213762f2ced7185e36a6d2859c04e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d61786265636b6572732f616d617a6f6e2d616c6578612d7068702f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/maxbeckers/amazon-alexa-php/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/c4183e6dd86e8dd7c22e666b87f2e4e819327972be9bed14d21b8212538fe186/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d61786265636b6572732f616d617a6f6e2d616c6578612d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/maxbeckers/amazon-alexa-php/?branch=master)[![Coverage Status](https://camo.githubusercontent.com/cbfb22b349c8d3d114b31fa921b92931ae13c4e514114c579cbcd4c237ef8810/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d61786265636b6572732f616d617a6f6e2d616c6578612d7068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/maxbeckers/amazon-alexa-php/?branch=master)[![MIT Licence](https://camo.githubusercontent.com/fabb40ab22588a0746bb0916ed92739171bde7fb31f281c627aa588bcba62cc2/68747470733a2f2f6261646765732e66726170736f66742e636f6d2f6f732f6d69742f6d69742e7376673f763d313033)](https://opensource.org/licenses/mit-license.php)[![contributions welcome](https://camo.githubusercontent.com/9e93e892d0685e1bf7a1d0bd7c8410d6ecf2086a0a7b48dd58a6b96fa556ea2a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f6e747269627574696f6e732d77656c636f6d652d627269676874677265656e2e7376673f7374796c653d666c6174)](https://github.com/maxbeckers/amazon-alexa-php/issues)

Amazon alexa php library
========================

[](#amazon-alexa-php-library)

This library is a helper for amazon echo (alexa) skills with php. With this library it's very simple to handle alexa requests in your php application. You only create some handlers for the requests of your alexa skill and add them to a registry.

Install via composer
--------------------

[](#install-via-composer)

Require the package with composer:

```
composer require winegard/winegard-alexa-php

```

Usage
-----

[](#usage)

Handle the request:

- map request data to request object
- validate request
- handle request data
- create response
- send response

### Map request data to request object

[](#map-request-data-to-request-object)

Map needed request headers and request body to `Request`.

```
use Winegard\AmazonAlexa\Request\Request;
...
$requestBody  = file_get_contents('php://input');
$alexaRequest = Request::fromAmazonRequest($requestBody, $_SERVER['HTTP_SIGNATURECERTCHAINURL'], $_SERVER['HTTP_SIGNATURE']);
```

### Validate request

[](#validate-request)

The `RequestValidator` will handle the amazon request validation.

```
use Winegard\AmazonAlexa\Validation\RequestValidator;
...
$validator = new RequestValidator();
$validator->validate($alexaRequest);
```

### Register request handlers

[](#register-request-handlers)

For different requests it's helpful to create different RequestHandlers.

```
use Winegard\AmazonAlexa\RequestHandler\RequestHandlerRegistry;
...
$requestHandlerRegistry = new RequestHandlerRegistry();
$requestHandlerRegistry->addHandler($myRequestHandler);
```

### Use registry to handle request

[](#use-registry-to-handle-request)

```
use Winegard\AmazonAlexa\RequestHandler\RequestHandlerRegistry;
...
$requestHandler = $requestHandlerRegistry->getSupportingHandler($alexaRequest);
$response       = $requestHandler->handleRequest($alexaRequest);
```

### Render response

[](#render-response)

```
header('Content-Type: application/json');
echo json_encode($response);
exit();
```

### Create a new request handler

[](#create-a-new-request-handler)

The new request handler must extend `AbstractRequestHandler`. In constructor set the `supportedApplicationIds` to your skill Ids.

```
public function __construct()
{
    $this->supportedApplicationIds = ['my_amazon_skill_id'];
}
```

Then implement the abstract `supportsRequest`-method.

```
public function supportsRequest(Request $request): bool
{
    return $request->request instanceOf Winegard\AmazonAlexa\Request\Request\Standard\IntentRequest &&
        'MyTestIntent' === $request->request->intent->name;
}
```

Then implement the `handleRequest`-method. For simple responses there is a `ResponseHelper`.

```
use Winegard\AmazonAlexa\Helper\ResponseHelper;
...
public function handleRequest(Request $request): Response
{
    return $this->responseHelper->respond('Success :)');
}
```

Check device address information
--------------------------------

[](#check-device-address-information)

To get either "Full Address" or "Country &amp; Postal Code" from the customer you need the permissions for user api call. More informations for the call see [device-address-api](https://developer.amazon.com/de/docs/custom-skills/device-address-api.html).

```
$helper = new DeviceAddressInformationHelper();
$fullAddress = $helper->getAddress($request);
$countryAndPostalCode = $helper->getCountryAndPostalCode($request);
```

Generate SSML
-------------

[](#generate-ssml)

For SSML output you can use the `SsmlGenerator`. With the helper will generate valid SSML for alexa. All types of alexa known SSML tags have a function in the `SsmlGeneator`. You can add all SSML you need to the generator and call `getSsml` to get the full string.

```
$ssmlGenerator = new SsmlGenerator();
$ssmlGenerator->say('one');
$ssmlGenerator->pauseStrength(SsmlGenerator::BREAK_STRENGTH_MEDIUM);
$ssmlGenerator->say('two');
$ssml = $ssmlGenerator->getSsml();
// $ssml === 'one  two'
```

Symfony Integration
-------------------

[](#symfony-integration)

There is also a symfony bundle on [maxbeckers/amazon-alexa-bundle](https://github.com/maxbeckers/amazon-alexa-bundle).

###  Health Score

22

—

LowBetter than 23% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 95.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~4 days

Recently: every ~10 days

Total

44

Last Release

989d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a356cdfacb23778607261d1060615cb0f5e8b0c0e35456e94a5ba0d7b015b334?d=identicon)[b3kN](/maintainers/b3kN)

---

Top Contributors

[![maxbeckers](https://avatars.githubusercontent.com/u/11738128?v=4)](https://github.com/maxbeckers "maxbeckers (212 commits)")[![devbanana](https://avatars.githubusercontent.com/u/1540834?v=4)](https://github.com/devbanana "devbanana (4 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (3 commits)")[![salvatorecordiano](https://avatars.githubusercontent.com/u/2036080?v=4)](https://github.com/salvatorecordiano "salvatorecordiano (2 commits)")[![derpue](https://avatars.githubusercontent.com/u/8439720?v=4)](https://github.com/derpue "derpue (1 commits)")

---

Tags

phplibraryechoPHP7AlexaAmazon Echophp72php71skillamazon-alexaamazon-alexa-phpamazon-echo-phpalexa-skillalexa-skill-phpalexa-sdkalexa-custom-skillssml

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/winegard-winegard-alexa-php/health.svg)

```
[![Health](https://phpackages.com/badges/winegard-winegard-alexa-php/health.svg)](https://phpackages.com/packages/winegard-winegard-alexa-php)
```

###  Alternatives

[maxbeckers/amazon-alexa-php

Php library for amazon echo (alexa) skill development.

11554.0k2](/packages/maxbeckers-amazon-alexa-php)[maxbeckers/amazon-alexa-bundle

Symfony Bundle for amazon alexa skills.

132.1k](/packages/maxbeckers-amazon-alexa-bundle)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)[phplicengine/bitly

Bitly API v4

22277.3k](/packages/phplicengine-bitly)[develpr/alexa-app

Set of classes to make creating simple Amazon Echo Alexa Apps easier with Lumen and to a lesser extent Laravel

9711.1k](/packages/develpr-alexa-app)[fabian-beiner/todoist-php-api-library

A PHP client library that provides a native interface to the official Todoist REST API.

4810.8k](/packages/fabian-beiner-todoist-php-api-library)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
