|
1 | 1 | # Encoders
|
2 | 2 |
|
3 |
| -[](https://travis-ci.org/jocic/PHP.Encoders) [](https://coveralls.io/github/jocic/PHP.Encoders?branch=master) [](https://www.codacy.com/app/jocic/PHP.Encoders?utm_source=github.com&utm_medium=referral&utm_content=jocic/PHP.Encoders&utm_campaign=Badge_Grade) [](https://packagist.org/packages/jocic/google-authenticator) |
| 3 | +[](https://travis-ci.org/jocic/PHP.Encoders) [](https://coveralls.io/github/jocic/PHP.Encoders?branch=master) [](https://www.codacy.com/app/jocic/PHP.Encoders?utm_source=github.com&utm_medium=referral&utm_content=jocic/PHP.Encoders&utm_campaign=Badge_Grade) [](https://packagist.org/packages/jocic/encoders) |
4 | 4 |
|
5 | 5 | Encoders is a creatively named PHP library containing various binary-to-text encoding implementations.
|
6 | 6 |
|
7 |
| -I basically wrote a Base 32 implementation for my another project Google Authenticator and thought to myself, hey...why not create an entire library featuring binary-to-text encoders, that's kind of fun? So here it is. A filler project, for fun. |
| 7 | +I basically wrote a Base 32 implementation for my other project, Google Authenticator which you can find on GitHub, and thought to myself, hey...why not create an entire library featuring binary-to-text encoders, that's kind of fun? So here it is. A filler project, for fun. |
| 8 | + |
| 9 | +Following specifications are referenced: |
| 10 | + |
| 11 | +* [RFC 4648](documentation/rfc4648.txt) - Base 16, Base 32 & Base 64 Data Encodings |
| 12 | + |
| 13 | +[](https://www.paypal.me/DjordjeJocic) |
8 | 14 |
|
9 | 15 | **Project is still under development...slow ride...take it easy...**
|
| 16 | + |
| 17 | +## Versioning Scheme |
| 18 | + |
| 19 | +I use a 3-digit [Semantic Versioning](https://semver.org/spec/v2.0.0.html) identifier, for example 1.0.2. These digits have the following meaning: |
| 20 | + |
| 21 | +* The first digit (1) specifies the MAJOR version number. |
| 22 | +* The second digit (0) specifies the MINOR version number. |
| 23 | +* The third digit (2) specifies the PATCH version number. |
| 24 | + |
| 25 | +Complete documentation can be found by following the link above. |
| 26 | + |
| 27 | +## Examples |
| 28 | + |
| 29 | +Using encoders from the library is extremely simple, just in case you are getting started with PHP programming, I've prepared several examples to help you get started. You simply need to instantiate an object of your desired encoder and use the "encode" or "decode" methods respectively. |
| 30 | + |
| 31 | +### Example 1 - Base Encoding & Decoding |
| 32 | + |
| 33 | +```php |
| 34 | +$encoder = new Jocic\Encoders\Base\Base32(); |
| 35 | + |
| 36 | +echo $encoder->encode("foo"); |
| 37 | +echo $encoder->decode("MZXW6==="); |
| 38 | +``` |
| 39 | + |
| 40 | +## Installation |
| 41 | + |
| 42 | +There's two ways you can add **Encoders** library to your project: |
| 43 | + |
| 44 | +* Copying files from the "source" directory to your project and requiring the "Autoload.php" script |
| 45 | +* Via Composer, by executing the command below |
| 46 | + |
| 47 | +```bash |
| 48 | +composer require jocic/encoders dev-master |
| 49 | +``` |
| 50 | + |
| 51 | +## Tests |
| 52 | + |
| 53 | +Following unit tests are available: |
| 54 | + |
| 55 | +* **Essentials** - Tests for library's essentials ex. Autoloader, etc. |
| 56 | +* **Base** - Tests for Base encoders - Base 16, Base 32 & Base 64. |
| 57 | + |
| 58 | +You can execute them easily from the terminal like in the example below. |
| 59 | + |
| 60 | +```bash |
| 61 | +bash ./scripts/phpunit.sh --testsuite essentials |
| 62 | +bash ./scripts/phpunit.sh --testsuite base |
| 63 | +``` |
| 64 | + |
| 65 | +Please don’t forget to install necessary dependencies before attempting to do the God's work above. They may be important. |
| 66 | + |
| 67 | +```bash |
| 68 | +bash ./scripts/composer.sh install |
| 69 | +``` |
| 70 | + |
| 71 | +## Contribution |
| 72 | + |
| 73 | +Please review the following documents if you are planning to contribute to the project: |
| 74 | + |
| 75 | +* [Contributor Covenant Code of Conduct](code_of_conduct.md) |
| 76 | +* [Contribution Guidelines](contributing.md) |
| 77 | +* [Pull Request Template](pull_request_template.md) |
| 78 | +* [MIT License](license.md) |
| 79 | + |
| 80 | +## Support |
| 81 | + |
| 82 | +Please don't hesitate to contact me if you have any questions, ideas, or concerns. |
| 83 | + |
| 84 | +My Twitter account is: [@jocic_91](https://www.twitter.com/jocic_91) |
| 85 | + |
| 86 | +My support E-Mail address is: [[email protected]](mailto:[email protected]) |
| 87 | + |
| 88 | +## Copyright & License |
| 89 | + |
| 90 | +Copyright (C) 2018 Đorđe Jocić |
| 91 | + |
| 92 | +Licensed under the MIT license. |
0 commit comments