PHPackages                             b00gizm/alexa-skill - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. b00gizm/alexa-skill

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

b00gizm/alexa-skill
===================

OOP wrappers for the Amazon Alexa Skill JSON interface

v1.0.0(9y ago)92921[1 issues](https://github.com/b00giZm/alexa-skill-php/issues)MITPHPPHP &gt;=5.5.0

Since Jan 5Pushed 9y ago4 watchersCompare

[ Source](https://github.com/b00giZm/alexa-skill-php)[ Packagist](https://packagist.org/packages/b00gizm/alexa-skill)[ Docs](https://github.com/b00gizm/alexa-skill-php)[ RSS](/packages/b00gizm-alexa-skill/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

alexa-skill-php
===============

[](#alexa-skill-php)

[![Build Status](https://camo.githubusercontent.com/48645afe29e0a7bc174677263d173ee9e3278c263923d5c62731227e01e0a102/68747470733a2f2f7472617669732d63692e6f72672f62303067695a6d2f616c6578612d736b696c6c2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/b00giZm/alexa-skill-php) [![Latest Stable Version](https://camo.githubusercontent.com/6d7b4fab95f38f74597b408f598d8784e6b95e768c2c50f3206a8836bee2be5a/68747470733a2f2f706f7365722e707567782e6f72672f62303067697a6d2f616c6578612d736b696c6c2f762f737461626c65)](https://packagist.org/packages/b00gizm/alexa-skill)

OOP wrappers for the Amazon [Alexa Skill JSON interface](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/alexa-skills-kit-interface-reference).

Install via Composer
--------------------

[](#install-via-composer)

```
composer require b00gizm/alexa-skill
```

Example
-------

[](#example)

### Quickstart

[](#quickstart)

Your first Alexa app in less than 10 lines of code!

```
$factory = new Alexa\EventFactory();
$alexa = new Alexa\Alexa($factory);
$alexa->onLaunchRequest(function(Alexa\Alexa $alexa, Alexa\LaunchRequest $request, Alexa\Session $session) {
    return $alexa->getResponse()->addPlainTextOutputSpeech("Welcome to my awesome app!");
});

return new JsonResponse($alexa->process($requestJson));
```

The `Alexa\Alexa` class contains several callback handlers to handle the different Alexa request types:

```
$alexa->onLaunchRequest(function(Alexa\Alexa $alexa, Alexa\LaunchRequest $request, Alexa\Session $session) { ... });
$alexa->onIntentRequest(function(Alexa\Alexa $alexa, Alexa\Intent $intent, Alexa\LaunchRequest $request, Alexa\Session $session) { ... });
$alexa->onSessionEndedRequest(function(Alexa\Alexa $alexa, Alexa\LaunchRequest $request, Alexa\Session $session) { ... });
```

Your callbacks should either return a valid `Alexa\Response` or `NULL` if it does not know how to handle a request (more on that later).

### Writing Your Own Handlers

[](#writing-your-own-handlers)

A more sophisticated way to provide Alexa request handlers is to write own handler classes which implement one (or more) of the following interfaces:

- `Alexa\Handler\LaunchRequestHandler`
- `Alexa\Handler\IntentRequestHandler`
- `Alexa\Handler\SessionEndedHandler`

Own request handlers must be registered with a `Alexa\EventProcessor` instance:

```
$factory = new Alexa\EventFactory();

$processor = new Alexa\EventProcessor();
$processor->setLaunchHandler(new MyLaunchHandler());
$processor->setIntentHandlers([
    new MyFooIntentHandler(),
    new MyBarIntentHandler(),
]);
$processor->setSessionEndedHandler(new MySessionEndedHandler());

$alexa = new Alexa\Alexa($factory, $processor);
```

You may have noticed that there is an array of intent handlers. When writing bigger apps with lots of intents, writing a custom handler for each intent may be the best solution to organize your code base and maintain testability.

Intent handlers are processed in the order as they come in. If a handler cannot handle a certain intent request, it should simply return `NULL` to notify the processor to try the next intent handler. When an intent request could be handled successfully, it should return a valid `Alexa\Response` object signal the processor that it should stop.

**Please keep in mind that `Alexa\Alexa`'s callback handlers will be always be preferred and *will override your registered custom handlers* if you try to use both at once for some reason.**

Autoloading
-----------

[](#autoloading)

This library uses [schmittjoh/serializer](https://github.com/schmittjoh/serializer) for serializing and deserializung, which itself relies on [doctrine/common](https://github.com/doctrine/common) for annotation support. If you're getting weird serializer errors, please append this to your `autolad.php` as a work around for the moment:

```
\Doctrine\Common\Annotations\AnnotationRegistry::registerLoader('class_exists');
```

Maintainer
----------

[](#maintainer)

Pascal Cremer

- Email:
- Twitter: [@b00gizm](https://twitter.com/b00gizm)
- Web:

License
-------

[](#license)

> The MIT License (MIT)
>
> Copyright (c) 2016-2017 Pascal Cremer
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
>
> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

3412d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/026acd5f5c3f792d8e666b284729abd9f5657c7e6d7612cafc349e99aafe22de?d=identicon)[b00gizm](/maintainers/b00gizm)

---

Top Contributors

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

---

Tags

jsonamazonwrapperAlexa

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/b00gizm-alexa-skill/health.svg)

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

###  Alternatives

[justinrainbow/json-schema

A library to validate a json schema.

3.6k316.9M613](/packages/justinrainbow-json-schema)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k89.3M626](/packages/jms-serializer-bundle)[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k472.8M135](/packages/mtdowling-jmespathphp)[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k135.8M851](/packages/jms-serializer)[colinodell/json5

UTF-8 compatible JSON5 parser for PHP

30422.2M45](/packages/colinodell-json5)[clue/ndjson-react

Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.

15267.7M16](/packages/clue-ndjson-react)

PHPackages © 2026

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