PHPackages                             kusanagi/katana-sdk-php7 - 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. [Framework](/categories/framework)
4. /
5. kusanagi/katana-sdk-php7

ActiveLibrary[Framework](/categories/framework)

kusanagi/katana-sdk-php7
========================

PHP7 SDK for the KATANA Framework

2.1.1(7y ago)52.2k2[8 issues](https://github.com/kusanagi/katana-sdk-php7/issues)MITPHPPHP ^7.0

Since Mar 22Pushed 4y ago6 watchersCompare

[ Source](https://github.com/kusanagi/katana-sdk-php7)[ Packagist](https://packagist.org/packages/kusanagi/katana-sdk-php7)[ Docs](https://kusanagi.io)[ RSS](/packages/kusanagi-katana-sdk-php7/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (49)Used By (0)

KATANA SDK for PHP7
===================

[](#katana-sdk-for-php7)

[![Build Status](https://camo.githubusercontent.com/0c7c23bbda793679b8763f49f26117c500ded0d50c5c8bf4915bd964c15a5bf5/68747470733a2f2f7472617669732d63692e6f72672f6b7573616e6167692f6b6174616e612d73646b2d706870372e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/kusanagi/katana-sdk-php7)[![Coverage Status](https://camo.githubusercontent.com/d144ab621b6ca6fbed11bb4f1657dbde674c999486d7076dea54b217362dc466/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6b7573616e6167692f6b6174616e612d73646b2d706870372f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/kusanagi/katana-sdk-php7?branch=master)[![License: MIT](https://camo.githubusercontent.com/08cef40a9105b6526ca22088bc514fbfdbc9aac1ddbf8d4e6c750e3a88a44dca/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d626c75652e737667)](https://opensource.org/licenses/MIT)

PHP7 SDK to interface with the **KATANA**™ framework ().

Requirements
------------

[](#requirements)

- KATANA Framework 2.1
- [libzmq](http://zeromq.org) 4.1.5+
- [zmq extension](https://github.com/mkoppanen/php-zmq)
- [msgpack extension](https://github.com/msgpack/msgpack-php)

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

[](#installation)

The PHP7 SDK can be installed using [composer](https://getcomposer.org/).

```
composer require kusanagi/katana-sdk-php7

```

Getting Started
---------------

[](#getting-started)

The SDK allow both **Services** and **Middlewares** to be created. Both of them require a source file and a configuration file pointing to it.

The first step to create a **Service** or a **Middleware** is to generate the configuration file, which will define the behavior of the component. In both cases the configuration include name and version of the component and the engine and source file to run it.

The configuration file for a **Service** define the different actions it can respond to, and can include http configuration so it can interact with a **Gateway**.

```
"@context": urn:katana:service
name: service_name
version: "0.1"
http-base-path: /0.1
info:
  title: Example Service
engine:
  runner: urn:katana:runner:php7
  path: ./example_service.php
action:
  - name: action_name
    http-path: /action/path
```

The configuration of a **Middleware** defines which kind of action (*request*, *response* or both), it responds to.

```
"@context": urn:katana:middleware
name: middleware_name
version: "0.1"
request: true
response: true
info:
  title: Example Middleware
engine:
  runner: urn:katana:runner:php7
  path: ./example_middleware.php
```

The following example illustrates how to create a **Service**. Given the previous configuration file, the source file must be located at `./example_service.php`, define the actions and run the component:

```
