2017 © Pedro Peláez
 

library message

The message encoder/decoder for message queue, it would be encrypted/decrypted between the transmission.

image

peixinchen/message

The message encoder/decoder for message queue, it would be encrypted/decrypted between the transmission.

  • Tuesday, January 17, 2017
  • by peixinchen
  • Repository
  • 0 Watchers
  • 0 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

message

编解码用于MessageQueue的消息体,同时进行加密, (*1)

Installation 安装

  1. 使用 composer
$ composer require peixinchen/message

Tutorial 使用指导

  1. 初始化编码器
<?php

use Peixinchen\Message\MessageCoder;

// 加/解密算法
$cipher = 'blowfish';

// 密钥
$secretKey = 'some random key';

$coder = new MessageCoder($cipher, $secretKey);
  1. 编码
// 消息体版本,用于格式升级时做不同处理
$version = '1.0.0';

// 实际要传递的消息内容
$payload = [
  'id' => 1,
  'text' => 'Some important message!',
];

$messageText = $coder->encode($version, $payload);
  1. 解码
list($version, $payload) = $coder->decode($messageText);

// 1.0.0
var_dump($version);

// [
//   'id' => 1,
//   'text' => 'Some important message!',
// ]
var_dump($payload);

The Versions

17/01 2017

dev-master

9999999-dev

The message encoder/decoder for message queue, it would be encrypted/decrypted between the transmission.

  Sources   Download

MIT

The Development Requires

by Avatar peixinchen

17/01 2017

1.0.0

1.0.0.0

The message encoder/decoder for message queue, it would be encrypted/decrypted between the transmission.

  Sources   Download

MIT

The Development Requires

by Avatar peixinchen