You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

127 lines
5.2 KiB

3 years ago
  1. [![Build Status](https://travis-ci.com/voku/portable-ascii.svg?branch=master)](https://travis-ci.com/voku/portable-ascii)
  2. [![Build status](https://ci.appveyor.com/api/projects/status/gnejjnk7qplr7f5t/branch/master?svg=true)](https://ci.appveyor.com/project/voku/portable-ascii/branch/master)
  3. [![Coverage Status](https://coveralls.io/repos/voku/portable-ascii/badge.svg?branch=master&service=github)](https://coveralls.io/github/voku/portable-ascii?branch=master)
  4. [![Codacy Badge](https://api.codacy.com/project/badge/Grade/997c9bb10d1c4791967bdf2e42013e8e)](https://www.codacy.com/app/voku/portable-ascii)
  5. [![Latest Stable Version](https://poser.pugx.org/voku/portable-ascii/v/stable)](https://packagist.org/packages/voku/portable-ascii)
  6. [![Total Downloads](https://poser.pugx.org/voku/portable-ascii/downloads)](https://packagist.org/packages/voku/portable-ascii)
  7. [![License](https://poser.pugx.org/voku/portable-ascii/license)](https://packagist.org/packages/voku/portable-ascii)
  8. [![Donate to this project using Paypal](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.me/moelleken)
  9. [![Donate to this project using Patreon](https://img.shields.io/badge/patreon-donate-yellow.svg)](https://www.patreon.com/voku)
  10. # 🔡 Portable ASCII
  11. ## Description
  12. It is written in PHP (PHP 7+) and can work without "mbstring", "iconv" or any other extra encoding php-extension on your server.
  13. The benefit of Portable ASCII is that it is easy to use, easy to bundle.
  14. The project based on ...
  15. + Sean M. Burke's work (https://metacpan.org/pod/Text::Unidecode)
  16. + Tomaz Solc's work (https://pypi.org/project/Unidecode/)
  17. + Portable UTF-8 work (https://github.com/voku/portable-utf8)
  18. + Daniel St. Jules's work (https://github.com/danielstjules/Stringy)
  19. + Johnny Broadway's work (https://github.com/jbroadway/urlify)
  20. + and many cherry-picks from "github"-gists and "Stack Overflow"-snippets ...
  21. ## Index
  22. * [Alternative](#alternative)
  23. * [Install](#install-portable-ascii-via-composer-require)
  24. * [Why Portable ASCII?](#why-portable-ascii)
  25. * [Requirements and Recommendations](#requirements-and-recommendations)
  26. * [Usage](#usage)
  27. * [Class methods](#class-methods)
  28. * [Unit Test](#unit-test)
  29. * [License and Copyright](#license-and-copyright)
  30. ## Alternative
  31. If you like a more Object Oriented Way to edit strings, then you can take a look at [voku/Stringy](https://github.com/voku/Stringy), it's a fork of "danielstjules/Stringy" but it used the "Portable ASCII"-Class and some extra methods.
  32. ```php
  33. // Portable ASCII
  34. use voku\helper\ASCII;
  35. ASCII::to_transliterate('déjà σσς iıii'); // 'deja sss iiii'
  36. // voku/Stringy
  37. use Stringy\Stringy as S;
  38. $stringy = S::create('déjà σσς iıii');
  39. $stringy->toTransliterate(); // 'deja sss iiii'
  40. ```
  41. ## Install "Portable ASCII" via "composer require"
  42. ```shell
  43. composer require voku/portable-ascii
  44. ```
  45. ## Why Portable ASCII?[]()
  46. I need ASCII char handling in different classes and before I added this functions into "Portable UTF-8",
  47. but this repo is more modular and portable, because it has no dependencies.
  48. ## Requirements and Recommendations
  49. * No extensions are required to run this library. Portable ASCII only needs PCRE library that is available by default since PHP 4.2.0 and cannot be disabled since PHP 5.3.0. "\u" modifier support in PCRE for ASCII handling is not a must.
  50. * PHP 7.0 is the minimum requirement
  51. * PHP 8.0 is also supported
  52. ## Usage
  53. Example: ASCII::to_ascii()
  54. ```php
  55. echo ASCII::to_ascii('�Düsseldorf�', 'de');
  56. // will output
  57. // Duesseldorf
  58. echo ASCII::to_ascii('�Düsseldorf�', 'en');
  59. // will output
  60. // Dusseldorf
  61. ```
  62. # Portable ASCII | API
  63. The API from the "ASCII"-Class is written as small static methods.
  64. ## Class methods
  65. %__functions_index__voku\helper\ASCII__%
  66. %__functions_list__voku\helper\ASCII__%
  67. ## Unit Test
  68. 1) [Composer](https://getcomposer.org) is a prerequisite for running the tests.
  69. ```
  70. composer install
  71. ```
  72. 2) The tests can be executed by running this command from the root directory:
  73. ```bash
  74. ./vendor/bin/phpunit
  75. ```
  76. ### Support
  77. For support and donations please visit [Github](https://github.com/voku/portable-ascii/) | [Issues](https://github.com/voku/portable-ascii/issues) | [PayPal](https://paypal.me/moelleken) | [Patreon](https://www.patreon.com/voku).
  78. For status updates and release announcements please visit [Releases](https://github.com/voku/portable-ascii/releases) | [Twitter](https://twitter.com/suckup_de) | [Patreon](https://www.patreon.com/voku/posts).
  79. For professional support please contact [me](https://about.me/voku).
  80. ### Thanks
  81. - Thanks to [GitHub](https://github.com) (Microsoft) for hosting the code and a good infrastructure including Issues-Managment, etc.
  82. - Thanks to [IntelliJ](https://www.jetbrains.com) as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
  83. - Thanks to [Travis CI](https://travis-ci.com/) for being the most awesome, easiest continous integration tool out there!
  84. - Thanks to [StyleCI](https://styleci.io/) for the simple but powerful code style check.
  85. - Thanks to [PHPStan](https://github.com/phpstan/phpstan) && [Psalm](https://github.com/vimeo/psalm) for really great Static analysis tools and for discover bugs in the code!
  86. ### License and Copyright
  87. Released under the MIT License - see `LICENSE.txt` for details.