Skip to content

A simple package for encoding and decoding data to be sent via http requests

License

Notifications You must be signed in to change notification settings

datrim/http-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HttpData

HttpData is a simple package for encoding and decoding data to be sent via http requests.

Installation

Composer

From the command line, run:

composer require datrim/http-data

Usage

The Basics

With the package now installed, you may use the two classes like so:

Encoding data (compressed)

<?php

use Datrim\HttpData\HttpDataEncoder;

$data = [
	'name' => 'MyData',
	'value' => 'My data value'
];

To encode data compressed (default)

$encoder = new HttpDataEncoder($data);

or, if the data should be transmitted uncompressed.

	$encoder = new HttpDataEncoder($data, false);

Then to get the encoded data:

$encoded Data = $encoder->data();

Decoding data

<?php

use Datrim\HttpData\HttpDataDecoder;

$decoder = new HttpDataDecoder($encodedData);
$decodedData = $decoder->data();

That's it!

License

The HttpData package is open-sourced software licensed under the MIT license

About

A simple package for encoding and decoding data to be sent via http requests

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages