Skip to content

ieu/base64url-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Base64Url

This is Base64Url encoder and decoder written in pure PHP.

Installation

First add this repo to composer.json:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/ieu/base64url-php"
        }
    ]
}

Then install it through composer:

composer require ieu/base64url:dev-master

Usage

base64url_encode

use function Ieu\Base64Url\base64url_encode;

// Encoding
base64url_encode("Hello, world!");

// Encoding without padding
base64url_encode("Hello, world!", false);

base64url_decode

use function Ieu\Base64Url\base64url_decode;

// Decode
base64url_decode("SGVsbG8sIHdvcmxkIQ==");

// Decode in strict mode
// Invalid char would cause decoding failure
base64url_decode("SGVsbG8sIHdvcmxkIQ==", true);

Tests

./vendor/bin/phpunit

Benchmarks

Encoding benchmarks:

./vendor/bin/phpbench run benchmarks/encode --report=my_report

Decoding benchmarks:

./vendor/bin/phpbench run benchmarks/decode --report=my_report

About

Base64Url encoder and decoder in pure PHP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages