<commit_before># URL-safe Base64 Handling

[![Build Status](https://travis-ci.org/Oire/base64.svg?branch=master)](https://travis-ci.org/Oire/base64)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Oire/base64/blob/master/LICENSE)

Encodes data to Base64 URL-safe way and decodes encoded data.  
**Note**: This package requires PHP 7.0 or above.

```php
use \Oire\Base64;
$text = "The quick brown fox jumps over the lazy dog";
echo Base64::encode($text).PHP_EOL;
```

This will output:  
`VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw`  
By default, the `encode()` method truncates padding `=` signs as PHP’s built-in decoder handles this correctly. However, if the second parameter is given and set to `true`, `=` signs will be replaced with tildes (`~`), i.e.:

```php
echo Base64::encode($text, true).PHP_EOL;
````

This will output:  
`VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw~~`

To decode the data, simply call `decode()`:
<commit_msg>Slight correction to Readme<commit_after># URL-safe Base64 Handling

[![Build Status](https://travis-ci.org/Oire/base64.svg?branch=master)](https://travis-ci.org/Oire/base64)
[![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Oire/base64/blob/master/LICENSE)

Encodes data to Base64 URL-safe way and decodes encoded data.  
**Note**: This package requires PHP 7.1 or above.

```php
use \Oire\Base64;
$text = "The quick brown fox jumps over the lazy dog";
echo Base64::encode($text).PHP_EOL;
```

This will output:  
`<KEY>`  
By default, the `encode()` method truncates padding `=` signs as PHP’s built-in decoder handles this correctly. However, if the second parameter is given and set to `true`, `=` signs will be replaced with tildes (`~`), i.e.:

```php
echo Base64::encode($text, true).PHP_EOL;
````

This will output:  
`<KEY>`

To decode the data, simply call `decode()`:

{'fraction_non_alphanumeric': 0.15160955347871236, 'fraction_numerical': 0.02284527518172378, 'mean_word_length': 5.059748427672956, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6129625', 'n_tokens_mistral': 745, 'n_tokens_neox': 694, 'n_words': 189}