PHPackages                             yurijbogdanov/base64 - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. yurijbogdanov/base64

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

yurijbogdanov/base64
====================

PHP Base64 (encode/decode) Library

v1.3.0(1y ago)03MITPHPPHP &gt;=8.0CI passing

Since Jan 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/yurijbogdanov/base64)[ Packagist](https://packagist.org/packages/yurijbogdanov/base64)[ Docs](https://github.com/yurijbogdanov/base64)[ RSS](/packages/yurijbogdanov-base64/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

PHP Base64 (encode/decode) Library
==================================

[](#php-base64-encodedecode-library)

[![Latest Stable Version](https://camo.githubusercontent.com/6de41213f28f57c6fde97bb3282aa01798254efbab5bce2da6f4d080b3023036/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f797572696a626f6764616e6f762f6261736536343f7374796c653d666c6174)](https://packagist.org/packages/yurijbogdanov/base64)[![License](https://camo.githubusercontent.com/bf2118d4af066bbc0fa95e430c6a7ba058d69a0f33437ebe2aa166e7814ed0ff/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f797572696a626f6764616e6f762f6261736536343f7374796c653d666c6174)](https://packagist.org/packages/yurijbogdanov/base64)[![Total Downloads](https://camo.githubusercontent.com/e598c5728b44d9e194c99c2be88914d2850030af2b10733f6806ef199cb9b582/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f797572696a626f6764616e6f762f6261736536342e7376673f7374796c653d666c6174)](https://packagist.org/packages/yurijbogdanov/base64)

Installation
------------

[](#installation)

```
composer require yurijbogdanov/base64

```

Usage
-----

[](#usage)

Encode:

```
$content = 'hello WoRld 123 ~~~';
$encodedContent = Base64::encode($content); // aGVsbG8gV29SbGQgMTIzIH5+fg==
$encodedContent = base64_encode($content);  // aGVsbG8gV29SbGQgMTIzIH5+fg==

```

Encode with variant:

```
$content = 'hello WoRld 123 ~~~';
$encodedContent = Base64::encode($content, Base64::VARIANT_ORIGINAL); // aGVsbG8gV29SbGQgMTIzIH5+fg==
$encodedContent = Base64::encode($content, Base64::VARIANT_ORIGINAL_NO_PADDING); // aGVsbG8gV29SbGQgMTIzIH5+fg
$encodedContent = Base64::encode($content, Base64::VARIANT_URLSAFE); // aGVsbG8gV29SbGQgMTIzIH5-fg==
$encodedContent = Base64::encode($content, Base64::VARIANT_URLSAFE_NO_PADDING); // aGVsbG8gV29SbGQgMTIzIH5-fg

```

Encode urlsafe (Syntactic sugar for "Base64::encode($content, Base64::VARIANT\_URLSAFE\_NO\_PADDING)"):

```
$content = 'hello WoRld 123 ~~~';
$encodedContent = Base64::encodeUrlsafe($content); // aGVsbG8gV29SbGQgMTIzIH5-fg

```

Decode:

```
$content = 'aGVsbG8gV29SbGQgMTIzIH5+fg==';
$decodedContent = Base64::decode($content); // hello WoRld 123 ~~~
$decodedContent = base64_decode($content);  // hello WoRld 123 ~~~

```

Decode with variant:

```
$decodedContent = Base64::decode("aGVsbG8gV29SbGQgMTIzIH5+fg==", Base64::VARIANT_ORIGINAL); // hello WoRld 123 ~~~
$decodedContent = Base64::decode("aGVsbG8gV29SbGQgMTIzIH5+fg", Base64::VARIANT_ORIGINAL_NO_PADDING); // hello WoRld 123 ~~~
$decodedContent = Base64::decode("aGVsbG8gV29SbGQgMTIzIH5-fg==", Base64::VARIANT_URLSAFE); // hello WoRld 123 ~~~
$decodedContent = Base64::decode("aGVsbG8gV29SbGQgMTIzIH5-fg", Base64::VARIANT_URLSAFE_NO_PADDING); // hello WoRld 123 ~~~

```

Decode urlsafe (Syntactic sugar for "Base64::decode($content, Base64::VARIANT\_URLSAFE\_NO\_PADDING)"):

```
$content = 'aGVsbG8gV29SbGQgMTIzIH5-fg';
$decodedContent = Base64::decode($content); // hello WoRld 123 ~~~

```

Usage via Terminal
------------------

[](#usage-via-terminal)

List of commands:

```
bin/base64

```

Encode:

```
bin/base64 encode [CONTENT]
bin/base64 encode "hello WoRld 123 ~~~"
# Output: aGVsbG8gV29SbGQgMTIzIH5+fg==

```

Encode with variant:

```
bin/base64 encode_with_variant [CONTENT] [VARIANT]
bin/base64 encode_with_variant "hello WoRld 123 ~~~" original
# Output: aGVsbG8gV29SbGQgMTIzIH5+fg==
bin/base64 encode_with_variant "hello WoRld 123 ~~~" original_no_padding
# Output: aGVsbG8gV29SbGQgMTIzIH5+fg
bin/base64 encode_with_variant "hello WoRld 123 ~~~" urlsafe
# Output: aGVsbG8gV29SbGQgMTIzIH5-fg==
bin/base64 encode_with_variant "hello WoRld 123 ~~~" urlsafe_no_padding
# Output: aGVsbG8gV29SbGQgMTIzIH5-fg

```

Encode urlsafe (Syntactic sugar for "bin/base64 encode\_with\_variant \[CONTENT\] urlsafe\_no\_padding"):

```
bin/base64 encode_urlsafe [CONTENT]
bin/base64 encode_urlsafe "hello WoRld 123 ~~~"
# Output: aGVsbG8gV29SbGQgMTIzIH5-fg

```

Decode:

```
bin/base64 decode [CONTENT]
bin/base64 decode aGVsbG8gV29SbGQgMTIzIH5+fg==
# Output: hello WoRld 123 ~~~

```

Decode with variant:

```
bin/base64 decode_with_variant [CONTENT] [VARIANT]
bin/base64 decode_with_variant aGVsbG8gV29SbGQgMTIzIH5+fg== original
# Output: hello WoRld 123 ~~~
bin/base64 decode_with_variant aGVsbG8gV29SbGQgMTIzIH5+fg original_no_padding
# Output: hello WoRld 123 ~~~
bin/base64 decode_with_variant aGVsbG8gV29SbGQgMTIzIH5-fg== urlsafe
# Output: hello WoRld 123 ~~~
bin/base64 decode_with_variant aGVsbG8gV29SbGQgMTIzIH5-fg urlsafe_no_padding
# Output: hello WoRld 123 ~~~

```

Decode urlsafe (Syntactic sugar for "bin/base64 decode\_with\_variant \[CONTENT\] urlsafe\_no\_padding"):

```
bin/base64 decode_urlsafe [CONTENT]
bin/base64 decode_urlsafe aGVsbG8gV29SbGQgMTIzIH5-fg
# Output: hello WoRld 123 ~~~

```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance42

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~96 days

Total

5

Last Release

465d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d846e41fe3c9624196805fd056443c3337004eb1b2ebcfb3986b17f54f5703dd?d=identicon)[yurijbogdanov](/maintainers/yurijbogdanov)

---

Tags

base64base64-decodebase64-encodedecodeencodephpurl-safeurlsafe-base64phpbase64encodedecodebase64\_encodebase64\_decodeURL safeurlsafe-base64

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/yurijbogdanov-base64/health.svg)

```
[![Health](https://phpackages.com/badges/yurijbogdanov-base64/health.svg)](https://phpackages.com/packages/yurijbogdanov-base64)
```

###  Alternatives

[paragonie/constant_time_encoding

Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)

901329.7M147](/packages/paragonie-constant-time-encoding)[delight-im/base64

Simple and convenient Base64 encoding and decoding for PHP

15158.1k6](/packages/delight-im-base64)[kunststube/rison

A PHP encoder and decoder for Rison, the compact JSON-like data format optimized for URIs.

2464.5k3](/packages/kunststube-rison)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
