Zigbee Frame Encoding/Decoding Library

Installs: 102

Dependents: 0

Suggesters: 0

Stars: 10

Watchers: 5

Forks: 5

Open Issues: 0

v2.4.1 2014-08-12 11:57 UTC


PHP library for encoding and decoding ZigBee Frames

This library contains classes that map to the various ZigBee frames. Each of those classes can be either constructed using a bytestring or using the getters/setters and static constructors.

Using the library


The easiest way to use the library is to add it as dependency in the composer.json of your project.

"require": {
    "munisense/zigbee": "~2.4",

Then run composer update and include the vendor/autoload.php in your project files, if not already.

Use the ZigBee library to unpack ZigBee frames

The library can be used to unpack a zigbee frame (for instance encoded in a base64 string) to the object model.

$input = base64_decode("AP8AAAA=");
$frame = new Munisense\Zigbee\ZCL\ZCLFrame($input);
echo $frame;


ZCLFrame (length: 5)
|- FrameControl     : 0b00000000
|  |- FrameType     : Profile Wide (0x00)
|  |- ManufIdPres   : Not Present (0x00)
|  |- Direction     : Server->Client (0x00)
|  `- DefaultResp   : Enabled (0x00)
|- TransactionId    : 0x8e
|- CommandId        : Read Attributes
|- Payload (length: 2)
`- Munisense\Zigbee\ZCL\General\ReadAttributesCommand (count: 1, length: 2)
   `- AttributeId: 0x0000
Use the ZigBee library to pack ZigBee frames

It is also possible to build a ZigBee frame using the objects, and extract the actual frame payload to send to the ZigBee network.

$zcl = ReadAttributesCommand::construct([

$output = $zcl->getFrame();

Running the tests

To run the tests you need phpunit installed. Instead of downloading the library as requirement for a project using Composer (and Packagist) you should have a clone of the library itself. Make sure you've ran composer install.

After that it is as simple as calling phpunit in the root folder everytime you want to run the tests.

Travis Continuous Integration

  • Master Build Status
  • Stable Build Status

Revision History


Added ZDP Discovery Commands

  • ExtendedSimpleDescReq and Rsp Command
  • UserDescConf and Set Command

Added ZDP Network Commands

  • MgmtBindReq, MgmtCacheReqCommand
  • MmtLqiReq and Rsp Command, with NeighborDescriptor structure
  • MmtRtgReq and Rsp Command, with RoutingDescriptor structure

Minor code organisation changes and added more ZDP Discovery functionality.

  • Renamed MuniZigbeeException to ZigbeeException
  • Removed Munisense specific frames
  • Added Node Descriptor + Commands
  • Added Power Descriptor + Commands
  • Added User Descriptor + Commands

Added the following ZDP Commands:

  • ActiveEP Req and Rsp
  • IEEEAddr Req and Rsp
  • NodeDesc Req
  • NWKAddr Req and Rsp
  • PowerDesc Req
  • SimpleDesc Req and Rsp


Copyright 2014 Munisense BV

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.