2017 © Pedro Peláez
 

library encode-decode

Encode/Decode library for PHP

image

asimlqt/encode-decode

Encode/Decode library for PHP

  • Tuesday, July 4, 2017
  • by Asim
  • Repository
  • 1 Watchers
  • 0 Stars
  • 37 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

encode-decode

This small library provides a simple and consistent way to encode and decode data in php. Either due to a non-existent native solution or to wrap the native calls to provide a simpler interface and error handling., (*1)

Currently there are only 2 encoders: - Base64Url - Json, (*2)

Base64Url

Encode example, (*3)

    try {
        $encoder = new Base64Url();
        $encoded = $encoder->encode("Encode/Decode library for PHP");
    } catch (EncodingException $e) {
        // handle exception
    }
    // encoded === "RW5jb2RlL0RlY29kZSBsaWJyYXJ5IGZvciBQSFA"

Decode example, (*4)

    try {
        $encoder = new Base64Url();
        $decoded = $encoder->decode("RW5jb2RlL0RlY29kZSBsaWJyYXJ5IGZvciBQSFA");
    } catch (DecodingException $e) {
        // handle exception
    }
    // decoded === "Encode/Decode library for PHP"

Json

Encode example, (*5)

    try {
        $encoder = new Json();
        $encoded = $encoder->encode(["encode" => "decode"]);
    } catch (EncodingException $e) {}

Decode example, (*6)

    try {
        $encoder = new Json();
        $decoded = $encoder->decode('{"encode":"decode"}');
    } catch (DecodingException $e) {}

By default decode will return an array, if you want to decode to an object then set assoc to false:, (*7)

    $encoder->setAssoc(false);

The Versions

04/07 2017

dev-master

9999999-dev https://github.com/asimlqt/encode-decode

Encode/Decode library for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

by Asim Liaquat

php json encode decode base64 base64url

04/07 2017

0.0.2

0.0.2.0 https://github.com/asimlqt/encode-decode

Encode/Decode library for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

by Asim Liaquat

php json encode decode base64 base64url

29/11 2016

0.0.1

0.0.1.0 https://github.com/asimlqt/encode-decode

Encode/Decode library for PHP

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

by Asim Liaquat

php json encode decode base64 base64url