Download .zip |
Info | Documentation | View files (211) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2019-09-07 (Yesterday) | Not yet rated by the users | Total: 14 This week: 14 | All time: 9,680 This week: 21 |
Version | License | PHP version | Categories | |||
portable-ascii 1.2.0 | MIT/X Consortium ... | 7 | Text processing, PHP 7 |
Description | Author | |
This package can manipulate text strings without special extensions. |
|
It is written in PHP (PHP 7+) and can work without "mbstring", "iconv" or any other extra encoding php-extension on your server.
The benefit of Portable ASCII is that it is easy to use, easy to bundle.
The project based on ... + Portable UTF-8 work (https://github.com/voku/portable-utf8) + Daniel St. Jules's work (https://github.com/danielstjules/Stringy) + Johnny Broadway's work (https://github.com/jbroadway/urlify) + and many cherry-picks from "github"-gists and "Stack Overflow"-snippets ...
If you like a more Object Oriented Way to edit strings, then you can take a look at voku/Stringy, it's a fork of "danielstjules/Stringy" but it used the "Portable ASCII"-Class and some extra methods.
// Portable ASCII
use voku\helper\ASCII;
ASCII::to_transliterate('déjà ??? i?ii'); // 'deja sss iiii'
// voku/Stringy
use Stringy\Stringy as S;
$stringy = S::create('déjà ??? i?ii');
$stringy->toTransliterate(); // 'deja sss iiii'
composer require voku/portable-ascii
I need ASCII char handling in different classes and before I added this functions into "Portable UTF-8", but this repo is more modular and portable, because it has no dependencies.
Example: ASCII::to_ascii()
echo ASCII::to_ascii('?Düsseldorf?', 'de');
// will output
// Duesseldorf
echo ASCII::to_ascii('?Düsseldorf?', 'en');
// will output
// Dusseldorf
The API from the "ASCII"-Class is written as small static methods.
Returns an replacement array for ASCII methods.
$array = ASCII::charsArray();
var_dump($array['ru']['?']); // 'b'
Returns an replacement array for ASCII methods with a mix of multiple languages.
$array = ASCII::charsArrayWithMultiLanguageValues();
var_dump($array['b']); // ['?', '?', '?', '?', '?']
Returns an replacement array for ASCII methods with one language.
For example, German will map 'ä' to 'ae', while other languages will simply return e.g. 'a'.
$array = ASCII::charsArrayWithOneLanguage('ru');
$tmpKey = \array_search('yo', $array['replace']);
echo $array['orig'][$tmpKey]; // '?'
Returns an replacement array for ASCII methods with multiple languages.
$array = ASCII::charsArrayWithSingleLanguageValues();
$tmpKey = \array_search('hnaik', $array['replace']);
echo $array['orig'][$tmpKey]; // '?'
Checks if a string is 7 bit ASCII.
ASCII::is_ascii('?'); // false
Normalize some MS Word special characters.
ASCII::normalize_msword('?Abcdef??'); // '"Abcdef..."'
Normalize the whitespace.
ASCII::normalize_whitespace("abc-\xc2\xa0-öäü-\xe2\x80\xaf-\xE2\x80\xAC", true); // "abc-\xc2\xa0-öäü- -"
Convert a string into language specific ASCII.
ASCII::to_ascii('?Düsseldorf?', 'en'); // Dusseldorf
Convert given string to safe filename (and keep string case).
ASCII::to_filename('??????.png', true)); // 'shdgshdg.png'
Convert a string into ASCII.
ASCII::to_transliterate('déjà ??? i?ii'); // 'deja sss iiii'
1) Composer is a prerequisite for running the tests.
composer install
2) The tests can be executed by running this command from the root directory:
./vendor/bin/phpunit
For support and donations please visit Github | Issues | PayPal | Patreon.
For status updates and release announcements please visit Releases | Twitter | Patreon.
For professional support please contact me.
Released under the MIT License - see LICENSE.txt
for details.
Files |
File | Role | Description | ||
---|---|---|---|---|
.github (4 files) | ||||
src (1 directory) | ||||
tests (4 files, 1 directory) | ||||
.editorconfig | Data | Auxiliary data | ||
.scrutinizer.yml | Data | Auxiliary data | ||
.styleci.yml | Data | Auxiliary data | ||
.travis.yml | Data | Auxiliary data | ||
appveyor.yml | Data | Auxiliary data | ||
CHANGELOG.md | Data | Auxiliary data | ||
circle.yml | Data | Auxiliary data | ||
composer.json | Data | Auxiliary data | ||
LICENSE.txt | Doc. | Documentation | ||
phpcs.php_cs | Example | Example script | ||
phpstan.neon | Data | Auxiliary data | ||
phpunit.xml | Data | Auxiliary data | ||
psalm.xml | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files | / | .github |
File | Role | Description |
---|---|---|
CONTRIBUTING.md | Data | Auxiliary data |
FUNDING.yml | Data | Auxiliary data |
ISSUE_TEMPLATE.md | Data | Auxiliary data |
PULL_REQUEST_TEMPLATE.md | Data | Auxiliary data |
Files | / | src | / | voku | / | helper | / | data |
File | Role | Description |
---|---|---|
ascii_by_languages.php | Aux. | Auxiliary script |
ascii_extras_by_languages.php | Aux. | Auxiliary script |
ascii_ord.php | Aux. | Auxiliary script |
x00.php | Aux. | Auxiliary script |
x01.php | Aux. | Auxiliary script |
x02.php | Aux. | Auxiliary script |
x03.php | Aux. | Auxiliary script |
x04.php | Aux. | Auxiliary script |
x05.php | Aux. | Auxiliary script |
x06.php | Aux. | Auxiliary script |
x07.php | Aux. | Auxiliary script |
x09.php | Aux. | Auxiliary script |
x0a.php | Aux. | Auxiliary script |
x0b.php | Aux. | Auxiliary script |
x0c.php | Aux. | Auxiliary script |
x0d.php | Aux. | Auxiliary script |
x0e.php | Aux. | Auxiliary script |
x0f.php | Aux. | Auxiliary script |
x10.php | Aux. | Auxiliary script |
x11.php | Aux. | Auxiliary script |
x12.php | Aux. | Auxiliary script |
x13.php | Aux. | Auxiliary script |
x14.php | Aux. | Auxiliary script |
x15.php | Aux. | Auxiliary script |
x16.php | Aux. | Auxiliary script |
x17.php | Aux. | Auxiliary script |
x18.php | Aux. | Auxiliary script |
x1d4.php | Aux. | Auxiliary script |
x1d5.php | Aux. | Auxiliary script |
x1d6.php | Aux. | Auxiliary script |
x1e.php | Aux. | Auxiliary script |
x1f.php | Aux. | Auxiliary script |
x1f1.php | Aux. | Auxiliary script |
x20.php | Aux. | Auxiliary script |
x21.php | Aux. | Auxiliary script |
x22.php | Aux. | Auxiliary script |
x23.php | Aux. | Auxiliary script |
x24.php | Aux. | Auxiliary script |
x25.php | Aux. | Auxiliary script |
x26.php | Aux. | Auxiliary script |
x27.php | Aux. | Auxiliary script |
x28.php | Aux. | Auxiliary script |
x2e.php | Aux. | Auxiliary script |
x2f.php | Aux. | Auxiliary script |
x30.php | Aux. | Auxiliary script |
x31.php | Aux. | Auxiliary script |
x32.php | Aux. | Auxiliary script |
x33.php | Aux. | Auxiliary script |
x4d.php | Aux. | Auxiliary script |
x4e.php | Aux. | Auxiliary script |
x4f.php | Aux. | Auxiliary script |
x50.php | Aux. | Auxiliary script |
x51.php | Aux. | Auxiliary script |
x52.php | Aux. | Auxiliary script |
x53.php | Aux. | Auxiliary script |
x54.php | Aux. | Auxiliary script |
x55.php | Aux. | Auxiliary script |
x56.php | Aux. | Auxiliary script |
x57.php | Aux. | Auxiliary script |
x58.php | Aux. | Auxiliary script |
x59.php | Aux. | Auxiliary script |
x5a.php | Aux. | Auxiliary script |
x5b.php | Aux. | Auxiliary script |
x5c.php | Aux. | Auxiliary script |
x5d.php | Aux. | Auxiliary script |
x5e.php | Aux. | Auxiliary script |
x5f.php | Aux. | Auxiliary script |
x60.php | Aux. | Auxiliary script |
x61.php | Aux. | Auxiliary script |
x62.php | Aux. | Auxiliary script |
x63.php | Aux. | Auxiliary script |
x64.php | Aux. | Auxiliary script |
x65.php | Aux. | Auxiliary script |
x66.php | Aux. | Auxiliary script |
x67.php | Aux. | Auxiliary script |
x68.php | Aux. | Auxiliary script |
x69.php | Aux. | Auxiliary script |
x6a.php | Aux. | Auxiliary script |
x6b.php | Aux. | Auxiliary script |
x6c.php | Aux. | Auxiliary script |
x6d.php | Aux. | Auxiliary script |
x6e.php | Aux. | Auxiliary script |
x6f.php | Aux. | Auxiliary script |
x70.php | Aux. | Auxiliary script |
x71.php | Aux. | Auxiliary script |
x72.php | Aux. | Auxiliary script |
x73.php | Aux. | Auxiliary script |
x74.php | Aux. | Auxiliary script |
x75.php | Aux. | Auxiliary script |
x76.php | Aux. | Auxiliary script |
x77.php | Aux. | Auxiliary script |
x78.php | Aux. | Auxiliary script |
x79.php | Aux. | Auxiliary script |
x7a.php | Aux. | Auxiliary script |
x7b.php | Aux. | Auxiliary script |
x7c.php | Aux. | Auxiliary script |
x7d.php | Aux. | Auxiliary script |
x7e.php | Aux. | Auxiliary script |
x7f.php | Aux. | Auxiliary script |
x80.php | Aux. | Auxiliary script |
x81.php | Aux. | Auxiliary script |
x82.php | Aux. | Auxiliary script |
x83.php | Aux. | Auxiliary script |
x84.php | Aux. | Auxiliary script |
x85.php | Aux. | Auxiliary script |
x86.php | Aux. | Auxiliary script |
x87.php | Aux. | Auxiliary script |
x88.php | Aux. | Auxiliary script |
x89.php | Aux. | Auxiliary script |
x8a.php | Aux. | Auxiliary script |
x8b.php | Aux. | Auxiliary script |
x8c.php | Aux. | Auxiliary script |
x8d.php | Aux. | Auxiliary script |
x8e.php | Aux. | Auxiliary script |
x8f.php | Aux. | Auxiliary script |
x90.php | Aux. | Auxiliary script |
x91.php | Aux. | Auxiliary script |
x92.php | Aux. | Auxiliary script |
x93.php | Aux. | Auxiliary script |
x94.php | Aux. | Auxiliary script |
x95.php | Aux. | Auxiliary script |
x96.php | Aux. | Auxiliary script |
x97.php | Aux. | Auxiliary script |
x98.php | Aux. | Auxiliary script |
x99.php | Aux. | Auxiliary script |
x9a.php | Aux. | Auxiliary script |
x9b.php | Aux. | Auxiliary script |
x9c.php | Aux. | Auxiliary script |
x9d.php | Aux. | Auxiliary script |
x9e.php | Aux. | Auxiliary script |
x9f.php | Aux. | Auxiliary script |
xa0.php | Aux. | Auxiliary script |
xa1.php | Aux. | Auxiliary script |
xa2.php | Aux. | Auxiliary script |
xa3.php | Aux. | Auxiliary script |
xa4.php | Aux. | Auxiliary script |
xac.php | Aux. | Auxiliary script |
xad.php | Aux. | Auxiliary script |
xae.php | Aux. | Auxiliary script |
xaf.php | Aux. | Auxiliary script |
xb0.php | Aux. | Auxiliary script |
xb1.php | Aux. | Auxiliary script |
xb2.php | Aux. | Auxiliary script |
xb3.php | Aux. | Auxiliary script |
xb4.php | Aux. | Auxiliary script |
xb5.php | Aux. | Auxiliary script |
xb6.php | Aux. | Auxiliary script |
xb7.php | Aux. | Auxiliary script |
xb8.php | Aux. | Auxiliary script |
xb9.php | Aux. | Auxiliary script |
xba.php | Aux. | Auxiliary script |
xbb.php | Aux. | Auxiliary script |
xbc.php | Aux. | Auxiliary script |
xbd.php | Aux. | Auxiliary script |
xbe.php | Aux. | Auxiliary script |
xbf.php | Aux. | Auxiliary script |
xc0.php | Aux. | Auxiliary script |
xc1.php | Aux. | Auxiliary script |
xc2.php | Aux. | Auxiliary script |
xc3.php | Aux. | Auxiliary script |
xc4.php | Aux. | Auxiliary script |
xc5.php | Aux. | Auxiliary script |
xc6.php | Aux. | Auxiliary script |
xc7.php | Aux. | Auxiliary script |
xc8.php | Aux. | Auxiliary script |
xc9.php | Aux. | Auxiliary script |
xca.php | Aux. | Auxiliary script |
xcb.php | Aux. | Auxiliary script |
xcc.php | Aux. | Auxiliary script |
xcd.php | Aux. | Auxiliary script |
xce.php | Aux. | Auxiliary script |
xcf.php | Aux. | Auxiliary script |
xd0.php | Aux. | Auxiliary script |
xd1.php | Aux. | Auxiliary script |
xd2.php | Aux. | Auxiliary script |
xd3.php | Aux. | Auxiliary script |
xd4.php | Aux. | Auxiliary script |
xd5.php | Aux. | Auxiliary script |
xd6.php | Aux. | Auxiliary script |
xd7.php | Aux. | Auxiliary script |
xf9.php | Aux. | Auxiliary script |
xfa.php | Aux. | Auxiliary script |
xfb.php | Aux. | Auxiliary script |
xfc.php | Aux. | Auxiliary script |
xfd.php | Aux. | Auxiliary script |
xfe.php | Aux. | Auxiliary script |
xff.php | Aux. | Auxiliary script |
Files | / | tests |
File | Role | Description | ||
---|---|---|---|---|
fixtures (1 file) | ||||
AsciiGlobalTest.php | Class | Class source | ||
AsciiTest.php | Class | Class source | ||
bootstrap.php | Aux. | Auxiliary script | ||
TransliterateTest.php | Class | Class source |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.