novemb3r/nginx-uid-decoder

A simple library to decode/encode uid from ngx_http_userid_module

0.1.3 2021-04-03 01:05 UTC

This package is auto-updated.

Last update: 2024-10-29 06:06:10 UTC


README

packagist-dt-badge release-version-badge php-version-badge code-climate-maintainability-badge license

A simple library to decode/encode uid from ngx_http_userid_module

Based on Alain Tiemblo answer on stackoverflow

When you use ngx_http_userid_module cookies set to variables $uid_got and $uid_set has format that differs from the one you get from user cookies. So, you have to decode them to compare.

Examples

 NginxUidDecoder::decodeCookie('CqCx7E5qMNUxrmAUAwMJAg==');
 // 'ECB1A00AD5306A4E1460AE3102090303'

 NginxUidDecoder::encodeUid('ECB1A00AD5306A4E1460AE3102090303');
 // 'CqCx7E5qMNUxrmAUAwMJAg=='

Installing

This library installs as a composer package with

$ composer require novemb3r/nginx-uid-decoder

or

{
    "require": {
        "novemb3r/nginx-uid-decoder": "dev-master"
    }
}

Testing

To execute test suites run

$ composer test