Download the PHP package byteferry/sdds_php without Composer
On this page you can find all versions of the php package byteferry/sdds_php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download byteferry/sdds_php
More information about byteferry/sdds_php
Files in byteferry/sdds_php
Package sdds_php
Short Description A PHP library to work with stream decode and encode according to the SDDS Specification.
License MIT
Homepage https://github.com/byteferry/sdds_php
Informations about the package sdds_php
SDDS for PHP
A PHP library to work with stream decode and encode according to the SDDS Specification.
Introduction
What is SDDS?
- Data Structure
SDDS is short word of "stream data dynamic structure".
- DSL
SDDS is a DSL (domain-specific language) .
The schema of SDDS is human-readable and machine and machine-readable.
- Parse Engine
SDDS is a parse engine coded according the SDDS Specification. You can rapid complete the developing of the binary communication program.
Features
- Multi-protocol support SDDS PHP could enabled the programs to support multiple communication protocols. Each protocol is a channel of the program.
-
Data types Support all data types required by the SDDS specification.
- Endianness support
You only need to configure Endianness(Big-Endian, Little-Endian) in the SDDS Schema. If there are individual endianness that are inconsistent, you can also configure them to the corresponding nodes.
- Charset support By default, UTF-8 is used, and you can also specify different encodings.
- Event extension All custom functions can be implemented with the corresponding EventHandler.
-
Formula expression Formula expression is supported before encoding or after decoding.
- Easy to debug
The default integration larapack/dd, you can use the browser to debug requests and output to the page via dd.
Why SDDS?
Usually we have to write different programs for different communication protocols. However, if you use SDDS, the programs you basically use are the same. And, SDDS has been implemented for you. All you have to do is expand the data stream operations, data types, bit operations, etc. that are not implemented by SDDS. And, through the JSON definition of SDDS Schema. When protocol had been changed, you only need to modify the SDDS Schema without modifying your code. SDDS can greatly speed up your development.
Quick tutorial
Install
Via Composer
Usage
-
Step 1: write SDDS Schema according to SDDS Specification .
- Step 2: Write the code to call SDDS PHP
- implement the Channel class:
For example: the channel class is named DecoderChannel.
-
Call your DecodeChannel
- Debug your SDDS Schema with DD using the http method through the browser. (To facilitate rapid development, we integrated Larapack/dd)
- Integrate with your communication program.
Advanced usage
Sometimes the existing code doesn't fully meet your needs. At this point, you need to extend the SDDS engine with EventHandler. A typical EventHandler looks like this:
There are 4 kind of EventHandler, See Sdds\Constants\EventTypeConstants for details.
We use them to meet different needs:
-
DateNode: When we need to add a logical processing of a node.
-
Packet: When we want to extend packet processing.
-
Stream: When we want to add a custom type, or to add before_action or after_action
- Bitwise: When we want to add a bit operation to a node.
After we have these EventHandlers, we need to register these EventHandlers before using.
Then, the DecoderChannel looks like this:
Please see the source code in the examples directory for more details.
Contributing
Please see CONDUCT for details.
Security
If you discover any security related issues, please create an issue in the issue tracker.
Credits
- ByteFerry
- All Contributors
License
The MIT License (MIT). Please see License File for more information.