Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 1.39 KB

README.md

File metadata and controls

49 lines (33 loc) · 1.39 KB

NOTE: For php <=7.1 see v1.0


ObjectGuid to base64 encode

This package only provides a function to encode an Object Guid to base64.

Problem

Microsoft azure immutable id is an encoding of the Object Guid to base64. but if you tray to encode the object guid directly it will preduse a not acceptable value or incorrect to the immutable id in microsoft azure. see example below

echo base64_encode("7ea2e22f-31cb-4c97-89eb-1b4501aafe40"); 
// output is "N2VhMmUyMmYtMzFjYi00Yzk3LTg5ZWItMWI0NTAxYWFmZTQw"

So this packge solves the problem.

Installation

composer require abublihi/guid-to-base64

Usage

use Abublihi\Guid\ToBase64;

$toBase64 = new ToBase64("7ea2e22f-31cb-4c97-89eb-1b4501aafe40");
echo $toBase64->getBase64(); // output "L+Kifssxl0yJ6xtFAar+QA=="
use Abublihi\Guid\ToBase64;

echo ToBase64::encode("748b2d72-706b-42f8-8b25-82fd8733860f"); // output "ci2LdGtw+EKLJYL9hzOGDw=="

Requirements

This package deeply depends on ramsey/uuid package.

References

Azure AD Connect: Design concepts

Credits