{"id":13828502,"url":"https://github.com/xobotyi/basen","last_synced_at":"2025-03-24T08:33:52.944Z","repository":{"id":57084747,"uuid":"136290254","full_name":"xobotyi/basen","owner":"xobotyi","description":"Text encoding utilities for PHP with no extensions dependencies. Base32, Base58, Base64 and much more!","archived":false,"fork":false,"pushed_at":"2020-05-21T15:32:56.000Z","size":25,"stargazers_count":12,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-19T19:50:20.857Z","etag":null,"topics":["base16","base32","base36","base58","base62","base64","binary","encoding","php7","rfc4648","text"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xobotyi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"patreon":"xobotyi"}},"created_at":"2018-06-06T07:29:19.000Z","updated_at":"2024-05-31T15:57:03.000Z","dependencies_parsed_at":"2022-08-24T22:50:36.899Z","dependency_job_id":null,"html_url":"https://github.com/xobotyi/basen","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xobotyi%2Fbasen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xobotyi%2Fbasen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xobotyi%2Fbasen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xobotyi%2Fbasen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xobotyi","download_url":"https://codeload.github.com/xobotyi/basen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221949901,"owners_count":16906485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["base16","base32","base36","base58","base62","base64","binary","encoding","php7","rfc4648","text"],"created_at":"2024-08-04T09:02:49.597Z","updated_at":"2024-10-28T23:07:51.052Z","avatar_url":"https://github.com/xobotyi.png","language":"PHP","funding_links":["https://patreon.com/xobotyi"],"categories":["PHP"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eBaseN\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://packagist.org/packages/xobotyi/basen\"\u003e\n        \u003cimg alt=\"License\" src=\"https://poser.pugx.org/xobotyi/basen/license\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/xobotyi/basen\"\u003e\n        \u003cimg alt=\"PHP 7 ready\" src=\"http://php7ready.timesplinter.ch/xobotyi/basen/badge.svg\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://travis-ci.org/xobotyi/basen\"\u003e\n        \u003cimg alt=\"Build Status\" src=\"https://travis-ci.org/xobotyi/basen.svg?branch=master\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.codacy.com/app/xobotyi/basen\"\u003e\n        \u003cimg alt=\"Codacy Grade\" src=\"https://api.codacy.com/project/badge/Grade/4b87c746d8d14a70a1ac399c48fad64d\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.codacy.com/app/xobotyi/basen\"\u003e\n        \u003cimg alt=\"Codacy Coverage\" src=\"https://api.codacy.com/project/badge/Coverage/4b87c746d8d14a70a1ac399c48fad64d\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/xobotyi/basen\"\u003e\n        \u003cimg alt=\"Latest Stable Version\" src=\"https://poser.pugx.org/xobotyi/basen/v/stable\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/xobotyi/basen\"\u003e\n        \u003cimg alt=\"Total Downloads\" src=\"https://poser.pugx.org/xobotyi/basen/downloads\" /\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## About\nPHP is a great language but unfortunately provides us with only one text encoding (base64) which even not URL safe. And there are no straight way to change its alphabet.  \nBaseN solves that problem and implements common binary-to-text algorithm for encodings whose alphabet fully covers number of bits that corresponds its length. And rough algorithm which will encode each byte separately, it is less compact but guarantee the encoding with given alphabet.  \nFurthermore it gives you methods to encode and decode integers themselves instead of their text representation.\n\n## Requirements\n- [PHP](//php.net/) 7.1+\n\n## Installation\nInstall with composer\n```bash\ncomposer require xobotyi/basen\n```\n\n## Usage\n```php\nuse xobotyi\\basen\\BaseN;\nuse xobotyi\\basen\\Base58;\n\n// use it for something usual\n$base8 = new BaseN('01234567', false, false, false);\necho $base8-\u003eencode(16) . \"\\n\"; // 142330\necho $base8-\u003eencodeInt(16) . \"\\n\"; // 20\n\n// or create your own encoder with own alphabet if needed\n$myOwnEncoder = new BaseN('a123d8e4fiwnmqkl', false, true, true);\necho $myOwnEncoder-\u003eencode(16) . \"\\n\"; // 313e\necho $myOwnEncoder-\u003eencodeInt(16) . \"\\n\"; // 1a\n\n// predefined encoder\necho Base58::encode(16) . \"\\n\"; // 3hC\n// or, with alternative alphabet\necho Base58::encode(16, Base58::ALPHABET_RIPPLE) . \"\\n\"; // hkD\necho Base58::encodeInt(16) . \"\\n\"; // G\n```\n\n## Builtin encodings\nBaseN provides few classes implementing most popular encodings: \n - [Base16](https://en.wikipedia.org/wiki/Base16) (0-9a-f)\n - [Base32](https://en.wikipedia.org/wiki/Base32) (a-z2-7)\n - [Base36](https://en.wikipedia.org/wiki/Base36) (0-9a-z)\n - [Base58](https://en.wikipedia.org/wiki/Base58) (0-9A-Za-v)\n - Base62 (0-9A-Za-z)\n - [Base64](https://en.wikipedia.org/wiki/Base64) (0-9A-Za-z+/)\n - [Base85](https://en.wikipedia.org/wiki/Base85) (!\"#$%\u0026'()*+,-./0-9:;\u003c=\u003e?@A-Z[\\]^_`a-u)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxobotyi%2Fbasen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxobotyi%2Fbasen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxobotyi%2Fbasen/lists"}