Base64 encode on shell

Sometimes you need to encode a stringĀ  with a base64 encoding. For example when trying to send a HTTP request with a Basic Authentication header like that: ### own controller: POST http://thedomain.com/webhook/post?XDEBUG_SESSION_START=11931 Content-Type: application/json Authorization: Basic c25zOlVzZVRoZWZvcmNlCg== { “uuid”: “08e9a8d3-9279-4af5-88ff-ebe42359f0e0”, “eventname”: “peng.page.publish”, “data”: { “sitemap_id”: “1234”, “locale”: “de_DE”, “path”: “unigue/page/path”, “title”: “Testpage over API”, “meta_title”: […]