delight-im/base64

Simple and convenient Base64 encoding and decoding for PHP

Maintainers

👁 delight-im

Package info

github.com/delight-im/PHP-Base64

pkg:composer/delight-im/base64

Statistics

Installs: 174 406

Dependents: 6

Suggesters: 0

Stars: 15

Open Issues: 0

v1.0.0 2017-07-24 18:59 UTC

Requires

  • php: >=5.3.0

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 687b2a49f663e162030a8d27b32838bbe7f91c78

urlbase64encodedecodeencodingdecodingURL-safebase-64

This package is auto-updated.

Last update: 2026-06-21 11:38:03 UTC


README

Simple and convenient Base64 encoding and decoding for PHP

Requirements

  • PHP 5.3.0+

Installation

  1. Include the library via Composer [?]:

    $ composer require delight-im/base64
    
  2. Include the Composer autoloader:

    require __DIR__ . '/vendor/autoload.php';

Usage

Standard

  • Encoding data

    \Delight\Base64\Base64::encode('Gallia est omnis divisa in partes tres');
    // string(52) "R2FsbGlhIGVzdCBvbW5pcyBkaXZpc2EgaW4gcGFydGVzIHRyZXM="
  • Decoding data

    \Delight\Base64\Base64::decode('R2FsbGlhIGVzdCBvbW5pcyBkaXZpc2EgaW4gcGFydGVzIHRyZXM=');
    // string(38) "Gallia est omnis divisa in partes tres"

URL-safe

  • Encoding data

    \Delight\Base64\Base64::encodeUrlSafe('πάντα χωρεῖ καὶ οὐδὲν μένει …');
    // string(80) "z4DOrM69z4TOsSDPh8-Jz4HOteG_liDOus6x4b22IM6_4b2QzrThvbLOvSDOvM6tzr3Otc65IOKApg~~"
  • Decoding data

    \Delight\Base64\Base64::decodeUrlSafe('z4DOrM69z4TOsSDPh8-Jz4HOteG_liDOus6x4b22IM6_4b2QzrThvbLOvSDOvM6tzr3Otc65IOKApg~~');
    // string(58) "πάντα χωρεῖ καὶ οὐδὲν μένει …"

URL-safe without padding

  • Encoding data

    \Delight\Base64\Base64::encodeUrlSafeWithoutPadding('πάντα χωρεῖ καὶ οὐδὲν μένει …');
    // string(78) "z4DOrM69z4TOsSDPh8-Jz4HOteG_liDOus6x4b22IM6_4b2QzrThvbLOvSDOvM6tzr3Otc65IOKApg"
  • Decoding data

    \Delight\Base64\Base64::decodeUrlSafeWithoutPadding('z4DOrM69z4TOsSDPh8-Jz4HOteG_liDOus6x4b22IM6_4b2QzrThvbLOvSDOvM6tzr3Otc65IOKApg');
    // string(58) "πάντα χωρεῖ καὶ οὐδὲν μένει …"

Specifications

Contributing

All contributions are welcome! If you wish to contribute, please create an issue first so that your feature, problem or question can be discussed.

License

This project is licensed under the terms of the MIT License.