PHPackages                             nomisoft/php-alexa-helper - 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. nomisoft/php-alexa-helper

AbandonedArchivedLibrary[API Development](/categories/api)

nomisoft/php-alexa-helper
=========================

A library to ease development when working with the Amazon Alexa API

v1.2(9y ago)53.2k↓100%2[1 PRs](https://github.com/nomisoft/PHP-Alexa-Helper/pulls)MITPHPPHP &gt;=5.3.0

Since Dec 21Pushed 8y ago1 watchersCompare

[ Source](https://github.com/nomisoft/PHP-Alexa-Helper)[ Packagist](https://packagist.org/packages/nomisoft/php-alexa-helper)[ Docs](https://github.com/nomisoft/php-alexa-helper)[ RSS](/packages/nomisoft-php-alexa-helper/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

PHP Alexa Helpers
=================

[](#php-alexa-helpers)

A library to ease development when working with the Amazon Alexa API

Installation
------------

[](#installation)

```
composer require nomisoft/php-alexa-helper

```

Usage
-----

[](#usage)

### Requests

[](#requests)

This will capture the JSON from the POST request

```
use \Alexa\Request\AlexaRequest;
$alexaRequest = AlexaRequest::fromRequest();
```

If you've already captured the posted JSON and have it in a variable you can pass it in to the constructor of the AlexaRequest class

```
$alexaRequest = new AlexaRequest($json);
```

The $alexaRequest object now behaves like an object representing the JSON posted by the Alexa API. You can directly access the properties as they match the JSON for example:

```
$alexaRequest->version;
$alexaRequest->session->application->applicationId;
$alexaRequest->request->intent->slots->ZodiacSign->value;
```

There are a few shortcut functions available

**$alexaRequest-&gt;getType()** is a shortcut returning the value of request-&gt;type from the JSON

**$alexaRequest-&gt;getIntent()** is a shortcut returning the value of request-&gt;intent-&gt;name from the JSON

**$alexaRequest-&gt;getSlots()** returns a key/value array of the intent slots. For example `"slots": { "ZodiacSign": { "name": "ZodiacSign", "value": "virgo" } }` would return `array('ZodiacSign'=>'virgo')`

### Validating requests

[](#validating-requests)

Skills being submitted for Alexa approval also need an extra step in verifying the requests come from Amazon. The RequestValidator class will do all necessary timestamp and certificate checks.

```
use \Alexa\Request\AlexaRequest;
use \Alexa\Request\RequestValidator;
$alexaRequest = AlexaRequest::fromRequest();
$validator = new RequestValidator($request);
if (!$validator->validate('YOUR_APP_ID')) {
    print_r($validator->getErrors());
}
```

### Responses

[](#responses)

To respond to the Alexa request you can construct an OutputSpeech object

```
use \Alexa\Request\AlexaRequest;
use \Alexa\Request\OutputSpeech;
$response = new AlexaResponse();
$speech = new OutputSpeech();
$speech->setText('Hello World');
$response->setOutputSpeech($speech);
```

When you invoke your Alexa skill your Amazon Echo (or other Alexa enabled device) will respond by saying 'Hello World'

By default a 'PlainText' type of speech response will be used. You can also respond using SSML

```
$speech = new OutputSpeech();
$speech->setType('SSML');
$speech->setText('Hello world.');
```

If you wish to also send a 'card' response which is shown on screen in the Alexa app you can create a Card object. The below example is for a 'Simple' card with just some text

```
use \Alexa\Request\Card;
$card = new Card();
$card->setContent('Hello World');
$response->setCard($card);
$response->render();
```

As well as setting the cards text content you can also set a title and return images to be displayed

```
$card = new Card();
$card->setType('Standard');
$card->setTitle('Hello World Title');
$card->setText('Hello World Content');
$card->setSmallImage('http://example.com/small.jpg');
$card->setLargeImage('http://example.com/large.jpg');
$response->setCard($card);
```

The AlexaResponse class is JSON serializable so to return your response to Amazon just `echo json_encode($response);` or call `$response->render()`. If you're using Symfony you might return the json with JsonResponse from your controller like:

```
$jsonResponse = new \Symfony\Component\HttpFoundation\JsonResponse($response);
return $jsonResponse;
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~20 days

Total

3

Last Release

3392d ago

### Community

---

Top Contributors

[![nomisoft](https://avatars.githubusercontent.com/u/6333315?v=4)](https://github.com/nomisoft "nomisoft (7 commits)")

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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