🔡 Portable ASCII library - performance optimized (ascii) string functions for php.

Overview

Build Status Build status codecov.io Codacy Badge Latest Stable Version Total Downloads License Donate to this project using Paypal Donate to this project using Patreon

🔡 Portable ASCII

Description

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 ...

Index

Alternative

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'

Install "Portable ASCII" via "composer require"

composer require voku/portable-ascii

Why 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.

Requirements and Recommendations

  • 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.
  • PHP 7.0 is the minimum requirement
  • PHP 8.0 is also supported

Usage

Example: ASCII::to_ascii()

  echo ASCII::to_ascii('�Düsseldorf�', 'de');
  
  // will output
  // Duesseldorf

  echo ASCII::to_ascii('�Düsseldorf�', 'en');
  
  // will output
  // Dusseldorf

Portable ASCII | API

The API from the "ASCII"-Class is written as small static methods.

Class methods

charsArray charsArrayWithMultiLanguageValues charsArrayWithOneLanguage charsArrayWithSingleLanguageValues
clean getAllLanguages is_ascii normalize_msword
normalize_whitespace remove_invisible_characters to_ascii to_filename
to_slugify to_transliterate

charsArray(bool $replace_extra_symbols): array

Returns an replacement array for ASCII methods.

EXAMPLE: $array = ASCII::charsArray(); var_dump($array['ru']['б']); // 'b'

Parameters:

  • bool $replace_extra_symbols [optional] <p>Add some more replacements e.g. "£" with " pound ".</p>

Return:

  • array

charsArrayWithMultiLanguageValues(bool $replace_extra_symbols): array

Returns an replacement array for ASCII methods with a mix of multiple languages.

EXAMPLE: $array = ASCII::charsArrayWithMultiLanguageValues(); var_dump($array['b']); // ['β', 'б', 'ဗ', 'ბ', 'ب']

Parameters:

  • bool $replace_extra_symbols [optional] <p>Add some more replacements e.g. "£" with " pound ".</p>

Return:

  • array <p>An array of replacements.</p>

charsArrayWithOneLanguage(string $language, bool $replace_extra_symbols, bool $asOrigReplaceArray): array

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'.

EXAMPLE: $array = ASCII::charsArrayWithOneLanguage('ru'); $tmpKey = \array_search('yo', $array['replace']); echo $array['orig'][$tmpKey]; // 'ё'

Parameters:

  • string $language [optional] <p>Language of the source string e.g.: en, de_at, or de-ch. (default is 'en') | ASCII::*_LANGUAGE_CODE</p>
  • bool $replace_extra_symbols [optional] <p>Add some more replacements e.g. "£" with " pound ".</p>
  • bool $asOrigReplaceArray [optional] <p>TRUE === return {orig: string[], replace: string[]} array</p>

Return:

  • array <p>An array of replacements.</p>

charsArrayWithSingleLanguageValues(bool $replace_extra_symbols, bool $asOrigReplaceArray): array

Returns an replacement array for ASCII methods with multiple languages.

EXAMPLE: $array = ASCII::charsArrayWithSingleLanguageValues(); $tmpKey = \array_search('hnaik', $array['replace']); echo $array['orig'][$tmpKey]; // '၌'

Parameters:

  • bool $replace_extra_symbols [optional] <p>Add some more replacements e.g. "£" with " pound ".</p>
  • bool $asOrigReplaceArray [optional] <p>TRUE === return {orig: string[], replace: string[]} array</p>

Return:

  • array <p>An array of replacements.</p>

clean(string $str, bool $normalize_whitespace, bool $keep_non_breaking_space, bool $normalize_msword, bool $remove_invisible_characters): string

Accepts a string and removes all non-UTF-8 characters from it + extras if needed.

Parameters:

  • string $str <p>The string to be sanitized.</p>
  • bool $normalize_whitespace [optional] <p>Set to true, if you need to normalize the whitespace.</p>
  • bool $keep_non_breaking_space [optional] <p>Set to true, to keep non-breaking-spaces, in combination with $normalize_whitespace</p>
  • bool $normalize_msword [optional] <p>Set to true, if you need to normalize MS Word chars e.g.: "…" => "..."</p>
  • bool $remove_invisible_characters [optional] <p>Set to false, if you not want to remove invisible characters e.g.: "\0"</p>

Return:

  • string <p>A clean UTF-8 string.</p>

getAllLanguages(): string[]

Get all languages from the constants "ASCII::.*LANGUAGE_CODE".

Parameters: nothing

Return:

  • string[]

is_ascii(string $str): bool

Checks if a string is 7 bit ASCII.

EXAMPLE: ASCII::is_ascii('白'); // false

Parameters:

  • string $str <p>The string to check.</p>

Return:

  • `bool

    true if it is ASCII
    false otherwise

`

normalize_msword(string $str): string

Returns a string with smart quotes, ellipsis characters, and dashes from Windows-1252 (commonly used in Word documents) replaced by their ASCII equivalents.

EXAMPLE: ASCII::normalize_msword('„Abcdef…”'); // '"Abcdef..."'

Parameters:

  • string $str <p>The string to be normalized.</p>

Return:

  • string <p>A string with normalized characters for commonly used chars in Word documents.</p>

normalize_whitespace(string $str, bool $keepNonBreakingSpace, bool $keepBidiUnicodeControls, bool $normalize_control_characters): string

Normalize the whitespace.

EXAMPLE: ASCII::normalize_whitespace("abc-\xc2\xa0-öäü-\xe2\x80\xaf-\xE2\x80\xAC", true); // "abc-\xc2\xa0-öäü- -"

Parameters:

  • string $str <p>The string to be normalized.</p>
  • bool $keepNonBreakingSpace [optional] <p>Set to true, to keep non-breaking-spaces.</p>
  • bool $keepBidiUnicodeControls [optional] <p>Set to true, to keep non-printable (for the web) bidirectional text chars.</p>
  • bool $normalize_control_characters [optional] <p>Set to true, to convert e.g. LINE-, PARAGRAPH-SEPARATOR with "\n" and LINE TABULATION with "\t".</p>

Return:

  • string <p>A string with normalized whitespace.</p>

remove_invisible_characters(string $str, bool $url_encoded, string $replacement, bool $keep_basic_control_characters): string

Remove invisible characters from a string.

e.g.: This prevents sandwiching null characters between ascii characters, like Java\0script.

copy&past from https://github.com/bcit-ci/CodeIgniter/blob/develop/system/core/Common.php

Parameters:

  • string $str
  • bool $url_encoded
  • string $replacement
  • bool $keep_basic_control_characters

Return:

  • string

to_ascii(string $str, string $language, bool $remove_unsupported_chars, bool $replace_extra_symbols, bool $use_transliterate, bool|null $replace_single_chars_only): string

Returns an ASCII version of the string. A set of non-ASCII characters are replaced with their closest ASCII counterparts, and the rest are removed by default. The language or locale of the source string can be supplied for language-specific transliteration in any of the following formats: en, en_GB, or en-GB. For example, passing "de" results in "äöü" mapping to "aeoeue" rather than "aou" as in other languages.

EXAMPLE: ASCII::to_ascii('�Düsseldorf�', 'en'); // Dusseldorf

Parameters:

  • string $str <p>The input string.</p>
  • string $language [optional] <p>Language of the source string. (default is 'en') | ASCII::*_LANGUAGE_CODE</p>
  • bool $remove_unsupported_chars [optional] <p>Whether or not to remove the unsupported characters.</p>
  • bool $replace_extra_symbols [optional] <p>Add some more replacements e.g. "£" with " pound ".</p>
  • bool $use_transliterate [optional] <p>Use ASCII::to_transliterate() for unknown chars.</p>
  • bool|null $replace_single_chars_only [optional] <p>Single char replacement is better for the performance, but some languages need to replace more then one char at the same time. | NULL === auto-setting, depended on the language</p>

Return:

  • string <p>A string that contains only ASCII characters.</p>

to_filename(string $str, bool $use_transliterate, string $fallback_char): string

Convert given string to safe filename (and keep string case).

EXAMPLE: ASCII::to_filename('שדגשדג.png', true)); // 'shdgshdg.png'

Parameters:

  • string $str
  • bool $use_transliterate <p>ASCII::to_transliterate() is used by default - unsafe characters are simply replaced with hyphen otherwise.</p>
  • string $fallback_char

Return:

  • string <p>A string that contains only safe characters for a filename.</p>

to_slugify(string $str, string $separator, string $language, string[] $replacements, bool $replace_extra_symbols, bool $use_str_to_lower, bool $use_transliterate): string

Converts the string into an URL slug. This includes replacing non-ASCII characters with their closest ASCII equivalents, removing remaining non-ASCII and non-alphanumeric characters, and replacing whitespace with $separator. The separator defaults to a single dash, and the string is also converted to lowercase. The language of the source string can also be supplied for language-specific transliteration.

Parameters:

  • string $str
  • string $separator [optional] <p>The string used to replace whitespace.</p>
  • string $language [optional] <p>Language of the source string. (default is 'en') | ASCII::*_LANGUAGE_CODE</p>
  • array<string, string> $replacements [optional] <p>A map of replaceable strings.</p>
  • bool $replace_extra_symbols [optional] <p>Add some more replacements e.g. "£" with " pound ".</p>
  • bool $use_str_to_lower [optional] <p>Use "string to lower" for the input.</p>
  • bool $use_transliterate [optional] <p>Use ASCII::to_transliterate() for unknown chars.</p>

Return:

  • string <p>A string that has been converted to an URL slug.</p>

to_transliterate(string $str, string|null $unknown, bool $strict): string

Returns an ASCII version of the string. A set of non-ASCII characters are replaced with their closest ASCII counterparts, and the rest are removed unless instructed otherwise.

EXAMPLE: ASCII::to_transliterate('déjà σσς iıii'); // 'deja sss iiii'

Parameters:

  • string $str <p>The input string.</p>
  • string|null $unknown [optional] <p>Character use if character unknown. (default is '?') But you can also use NULL to keep the unknown chars.</p>
  • bool $strict [optional] <p>Use "transliterator_transliterate()" from PHP-Intl

Return:

  • string <p>A String that contains only ASCII characters.</p>

Unit Test

  1. Composer is a prerequisite for running the tests.
composer install
  1. The tests can be executed by running this command from the root directory:
./vendor/bin/phpunit

Support

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.

Thanks

  • Thanks to GitHub (Microsoft) for hosting the code and a good infrastructure including Issues-Managment, etc.
  • Thanks to IntelliJ as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
  • Thanks to Travis CI for being the most awesome, easiest continous integration tool out there!
  • Thanks to StyleCI for the simple but powerful code style check.
  • Thanks to PHPStan && Psalm for really great Static analysis tools and for discover bugs in the code!

License and Copyright

Released under the MIT License - see LICENSE.txt for details.

Comments
  • Is Russian to ASCII correct?

    Is Russian to ASCII correct?

    Example: Is this correct?

    "лысая гора" -> "lysaja gora"


    Can a native speaker, please check the character-replacement, thanks.

    https://github.com/voku/portable-ascii/blob/master/src/voku/helper/data/ascii_by_languages.php#L468

    opened by voku 17
  • Is French to ASCII correct?

    Is French to ASCII correct?

    Example: Is this correct?

    "français" -> "francais"


    Can a native speaker, please check the character-replacement, thanks.

    https://github.com/voku/portable-ascii/blob/master/src/voku/helper/data/ascii_by_languages.php#L1055

    opened by voku 7
  • Is Serbian to ASCII correct?

    Is Serbian to ASCII correct?

    Example: Is this correct?

    "универзитет" -> "univerzitet"


    Can a native speaker, please check the character-replacement, thanks.

    https://github.com/voku/portable-ascii/blob/master/src/voku/helper/data/ascii_by_languages.php#L926

    opened by voku 6
  • Upgrade code to work in PHP8 or greater and/or Laravel 9 or greater

    Upgrade code to work in PHP8 or greater and/or Laravel 9 or greater

    Fixes: https://github.com/voku/portable-ascii/issues/86

    This repo doesn't work in PHP 8, 8.1 or 8.2 due to the namespaces not being Capitalized.

    • Have updated the GitHub workflows up to php 8.2
    • Have updated the namespaces.
    • Have updated composer.json and removed php 7 as security updates ended in 28 November 2022.
    • Have updated readme with new namespaces
    • Update AppVeyor php test environment from 7.0.33 to 8.0.2

    Need to update the connecting repos now.

    Linked to Pull Requests

    https://github.com/voku/html-compress-twig/pull/5

    https://github.com/voku/HtmlMin/pull/85

    https://github.com/voku/simple_html_dom/pull/95

    https://github.com/voku/simple-cache/pull/30

    https://github.com/voku/portable-ascii/pull/87

    Tested on the following

    Tested on PHP 8.2 and Laravel 9.1

    opened by summercms 4
  • Update v1.6.0 broke Laravel's builds

    Update v1.6.0 broke Laravel's builds

    What is this feature about (expected vs actual behaviour)?

    Seems like release v1.6.0 broke Laravel's build and subsequently all PR's that are sent in since are failing as well: https://github.com/laravel/framework/runs/4920401730?check_suite_focus=true#step:8:138

    It seems most likely that this commit is the culprit: https://github.com/voku/portable-ascii/commit/acaf86813ba78f0787bcf6294fc1b55c044ae7a5

    Changing the behaviour here seems like a breaking change to me and should probably be done in a major release?

    How can I reproduce it?

    voku\helper\ASCII::to_ascii('пиздюк.txt');
    

    Expected output: pizdyuk.txt (pre 1.6.0) Given output: pizdiuk.txt (as of 1.6.0)

    Does it take minutes, hours or days to fix?

    Think this is an easy fix by just rolling back the commit and tagging a new patch release.

    opened by driesvints 4
  • Is Georgian to ASCII correct?

    Is Georgian to ASCII correct?

    Example: Is this correct?

    "ბავშვები" -> "bavshvebi"


    Can a native speaker, please check the character-replacement, thanks.

    https://github.com/voku/portable-ascii/blob/master/src/voku/helper/data/ascii_by_languages.php#L431

    good first issue 
    opened by voku 4
  • Is Finnish to ASCII correct?

    Is Finnish to ASCII correct?

    Example: Is this correct?

    "päiväkoti" -> "paivakoti"


    Can a native speaker, please check the character-replacement, thanks.

    https://github.com/voku/portable-ascii/blob/master/src/voku/helper/data/ascii_by_languages.php#L424

    opened by voku 4
  • Is Croatian to ASCII correct?

    Is Croatian to ASCII correct?

    Example: Is this correct?

    "sveučilišt" -> "sveucilist"


    Can a native speaker, please check the character-replacement, thanks.

    https://github.com/voku/portable-ascii/blob/master/src/voku/helper/data/ascii_by_languages.php#L412

    opened by voku 4
  • Issue compared to original stringy

    Issue compared to original stringy

    I've replaced (locally) Laravel's Str::ascii with a call to this package, however some of the results are not quite as expected. For example, the following test fails:

    $this->assertSame('h H sht SHT a A y Y', Str::ascii('х Х щ Щ ъ Ъ ь Ь', 'bg'));
    
    Failed asserting that two strings are identical.
    
    --- Expected
    +++ Actual
    @@ @@
    -'h H sht SHT a A y Y'
    +'h H sht Sht a A  '
    
    invalid 
    opened by GrahamCampbell 4
  • Upgrade to GitHub-native Dependabot

    Upgrade to GitHub-native Dependabot

    Dependabot Preview will be shut down on August 3rd, 2021. In order to keep getting Dependabot updates, please merge this PR and migrate to GitHub-native Dependabot before then.

    Dependabot has been fully integrated into GitHub, so you no longer have to install and manage a separate app. This pull request migrates your configuration from Dependabot.com to a config file, using the new syntax. When merged, we'll swap out dependabot-preview (me) for a new dependabot app, and you'll be all set!

    With this change, you'll now use the Dependabot page in GitHub, rather than the Dependabot dashboard, to monitor your version updates, and you'll configure Dependabot through the new config file rather than a UI.

    If you've got any questions or feedback for us, please let us know by creating an issue in the dependabot/dependabot-core repository.

    Learn more about migrating to GitHub-native Dependabot

    Please note that regular @dependabot commands do not work on this pull request.

    dependencies 
    opened by dependabot-preview[bot] 3
  • Some character mappings include a quote symbol

    Some character mappings include a quote symbol

    Some ASCII character mappings include a quote symbol:

    https://github.com/voku/portable-ascii/blob/0a05e9edb3b51f4a04ae9c2da7ba57b091200610/src/voku/helper/data/ascii_by_languages.php#L1224-L1225

    https://github.com/voku/portable-ascii/blob/0a05e9edb3b51f4a04ae9c2da7ba57b091200610/src/voku/helper/data/ascii_by_languages.php#L1228-L1229

    Were these intended?

    opened by brandonkelly 3
  • Update codecov/codecov-action action to v3

    Update codecov/codecov-action action to v3

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | codecov/codecov-action | action | major | v2 -> v3 |


    Release Notes

    codecov/codecov-action

    v3

    Compare Source


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 2
  • Update shivammathur/setup-php action to v2.22.0

    Update shivammathur/setup-php action to v2.22.0

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | shivammathur/setup-php | action | minor | 2.17.1 -> 2.22.0 |


    Release Notes

    shivammathur/setup-php

    v2.22.0

    Compare Source

    Support Ukraine

    #StandWithUkraine


    - name: Setup PHP with debugging symbols
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
      env:
        debug: true 
    
    - name: Setup PHP with intl
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
        extensions: intl-72.1
    
    • Existing PHP version on GitHub actions Ubuntu images is now updated if ppa:ondrej/php is missing regardless of the update environment variable. (actions/runner-images#​6331).

    • Environment variable COMPOSER_NO_AUDIT is now set by default. If you would like to run the composer audit in your workflows, please add a step with composer audit command. (#​635, #​636)

    - name: Composer audit
      run: composer audit
    
    • Switched to GITHUB_OUTPUT environment file for setting up outputs. If you are using setup-php on self-hosted runners, please update it to 2.297.0 or greater. More Info (#​654)

    • Updated sqlsrv and pdo_sqlsrv version to 5.10.1 for PHP 7.0 and above on Linux.

    • Improved support for phalcon5 extension to set up the latest stable version.

    • Improved symfony-cli support to fetch the artifact URL from the brew tap on Linux. (#​641, #​652, #​653)

    • Improved fetching brew taps on Linux to avoid brew's overhead.

    • Fixed installing extension packages on self-hosted Linux runners. (#​642)

    • Fixed support for couchbase and firebird extensions after GitHub release page changes.

    • Fixed support for older versions of laravel/pint. (#​647)

    • Updated Node.js dependencies.


    Full Changelog: https://github.com/shivammathur/setup-php/compare/2.21.2...2.22.0

    Thanks! @​alcaeus and @​jderusse for the contributions 🎉

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    v2.21.2

    Compare Source

    Support Ukraine

    #StandWithUkraine


    • Added support for rector in tools input. #​627
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: 8.1
        tools: rector
    
    • Added support for ast extension on macOS using shivammathur/extensions tap.
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: 8.1
        extensions: ast
    
    • Fixed support for symfony-cli on Linux #​632
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: 8.1
        tools: symfony
    
    • Fixed installing unstable extensions from PECL. #​625
    • Updated Node.js dependencies.

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    v2.21.1

    Compare Source

    Support Ukraine

    #StandWithUkraine


    • Fixed installing tools' old versions which are composer plugins.

    • Updated Node.js dependencies.


    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    v2.21.0

    Compare Source

    Support Ukraine

    #StandWithUkraine


    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: `8.1`
        tools: pint
    
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: `8.1`
        extensions: phalcon5
    
    • Added support for Private Packagist authentication for composer. Docs
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
      env:
        PACKAGIST_TOKEN: ${{ secrets.PACKAGIST_TOKEN }}
    
    • Added support for manual JSON-based authentication for composer Docs
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
      env:
        COMPOSER_AUTH_JSON: |
          {
            "http-basic": {
              "example.org": {
                "username": "${{ secrets.EXAMPLE_ORG_USERNAME }}",
                "password": "${{ secrets.EXAMPLE_ORG_PASSWORD }}"
              }
            }
          }
    
    • Deprecated COMPOSER_TOKEN in favor of GITHUB_TOKEN. Docs
    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
      env:
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
    
    • Updated Node.js dependencies.

    Thanks! @​phpstan for the sponsorship ❤️

    Thanks! @​d8vjork and @​ChristophWurst for the contributions 🎉

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    v2.20.1

    Compare Source

    Support Ukraine

    #StandWithUkraine



    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    v2.20.0

    Compare Source

    Support Ukraine

    #StandWithUkraine


    • Improved support for event extension on Linux and macOS for PHP 5.4 and above. #​604

    • Fixed support for composer plugins in tools input. Since composer 2.2, the plugins are required to be marked as allowed in the composer config. This will now be done by default. #​611

    • Added support to show code coverage driver's (Xdebug/PCOV) version in the logs when setup using the coverage input. #​610

    • Fixed a bug where PHP was not added to PATH during the action run on self-hosted Windows environments. #​609

    • Fixed a bug where the tool cache path was not set on self-hosted environments. #​606

    • Updated Node.js dependencies.


    Thanks! @​jrfnl, @​dino182 and @​markseuffert for the contributions 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    v2.19.1

    Compare Source

    Support Ukraine

    #StandWithUkraine


    • Fixed support for deployer.

    • Updated Node.js dependencies.


    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    v2.19.0

    Compare Source

    Support Ukraine

    #StandWithUkraine


    • Added support for ubuntu-22.04 runner. Docs

    • Added support for Couchbase extension 4.x for PHP 7.4 and above. Also added support to specify the extension version you need. https://github.com/shivammathur/setup-php/issues/593

      Note: Please use the extensions cache if using the latest Couchbase version on Linux as it can take 10+ minutes to build along with its library.

      To install the latest version of couchbase extension

      - name: Setup PHP
        uses: shivammathur@setup-php@v2
        with:
          php-version: '8.1'
          extensions: couchbase
      

      To install a specific version - suffix couchbase with exact version you want in the extensions input.

      - name: Setup PHP
        uses: shivammathur@setup-php@v2
        with:
          php-version: '7.4'
          extensions: couchbase-2.6.2
      
    • Improved fallback support upon cache failure in composer setup. This fixes an error when the latest composer version was installed on older PHP versions when fetching composer from shivammathur/composer-cache failed.

    • Bumped Node.js version required to 16.x. Also bumped build target version to ES2021.

    • Removed support for Debian 9 and Ubuntu 21.04 for self-hosted runners. Docs

    • Fixed tools setup with older composer versions which do not create composer.json if missing in the directory.

    • Fixed support for extensions on macOS where the extension package name might conflict with package names in homebrew-core repo. This fixes support for redis extension on macOS on PHP 7.0.

    • Fixed enabling cached extensions which depend on other extensions on PHP 7.1 and lower.

    • Fixed setting default INI values so that it is possible to override those using php -c. https://github.com/shivammathur/setup-php/issues/595

    • Fixed PECL support for PHP 5.3, this was broken in previous release while adding support for specifying configure options, as that is only supported on PHP 5.4 and above.

    • Fixed identifying the latest protoc release.

    • Removed unnecessary fs dependency.

    • Added dependabot config to update older actions in workflows. https://github.com/shivammathur/setup-php/pull/597

    • Added permissions for GITHUB_TOKEN in workflows. https://github.com/shivammathur/setup-php/pull/596

    • Updated Node.js dependencies.


    Thanks! @​naveensrinivasan for the contributions 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    v2.18.1

    Compare Source

    Support Ukraine

    #StandWithUkraine


    - name: Setup PHP with intl
      uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
        extensions: intl-71.1
    
    • Added support for macOS Monterey (macos-12) GitHub hosted environment.

    • Added support for mcrypt extension using shivammathur/extensions tap on macOS.

    • Fixed patching brew for overwriting existing linked libraries.

    • Fixed identifying the latest protoc release.

    • Updated Node.js dependencies.


    Thanks! @​jderusse for the contributions 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status

    v2.18.0

    Compare Source

    Support Ukraine

    #StandWithUkraine


    • Added support for installing libraries and custom configure options for PECL extensions. #​575. Docs.

    • Added support for blackfire extension on PHP 8.1 on Windows.

    • Improved support for http extension on Windows and self-hosted environments.

    • Fixed installing php-dev package on self-hosted environments when missing. #​569

    • Fixed linking pecl ini file on self-hosted environments. #​569

    • Fixed copying extensions when installed using brew from its Cellar to extension directory on macOS.

    • Fixed generating extension dependency map.

    • Fixed a bug in log functions on Linux and macOS by using local variables.

    • Improved switching versions on Linux. #​572

    • Improved enabling default extensions by reducing PHP calls.

    • Bumped actions/checkout, actions/upload-artifact, actions/download-artifact and actions/cache version in examples and workflows to v3. #​571, #​577

    • Added PECL customization guide to README.

    • Updated Node.js dependencies.


    Thanks! @​jrfnl for the contributions 🚀

    Follow for updates

    setup-php reddit setup-php twitter setup-php status


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 2
  • Update actions/cache action to v3

    Update actions/cache action to v3

    Mend Renovate

    This PR contains the following updates:

    | Package | Type | Update | Change | |---|---|---|---| | actions/cache | action | major | v2.1.7 -> v3.0.11 |


    Release Notes

    actions/cache

    v3.0.11

    Compare Source

    What's Changed

    New Contributors

    Full Changelog: https://github.com/actions/cache/compare/v3...v3.0.11

    v3.0.10

    Compare Source

    • Fix a bug with sorting inputs.
    • Update definition for restore-keys in README.md

    v3.0.9

    Compare Source

    • Enhanced the warning message for cache unavailability in case of GHES.

    v3.0.8

    Compare Source

    What's Changed

    • Fix zstd not working for windows on gnu tar in issues.
    • Allow users to provide a custom timeout as input for aborting cache segment download using the environment variable SEGMENT_DOWNLOAD_TIMEOUT_MIN. Default is 60 minutes.

    v3.0.7

    Compare Source

    What's Changed

    • Fix for the download stuck problem has been added in actions/cache for users who were intermittently facing the issue. As part of this fix, new timeout has been introduced in the download step to stop the download if it doesn't complete within an hour and run the rest of the workflow without erroring out.

    v3.0.6

    Compare Source

    What's Changed
    New Contributors

    Full Changelog: https://github.com/actions/cache/compare/v3...v3.0.6

    v3.0.5

    Compare Source

    Removed error handling by consuming actions/cache 3.0 toolkit, Now cache server error handling will be done by toolkit.

    v3.0.4

    Compare Source

    In this release, we have fixed the tar creation error while trying to create it with path as ~/ home folder on ubuntu-latest.

    v3.0.3

    Compare Source

    Fixed avoiding empty cache save when no files are available for caching. (https://github.com/actions/cache/issues/624)

    v3.0.2

    Compare Source

    This release adds the support for dynamic cache size cap on GHES.

    v3.0.1

    Compare Source

    • Added support for caching from GHES 3.5.
    • Fixed download issue for files > 2GB during restore.

    v3.0.0

    Compare Source

    • This change adds a minimum runner version(node12 -> node16), which can break users using an out-of-date/fork of the runner. This would be most commonly affecting users on GHES 3.3 or before, as those runners do not support node16 actions and they can use actions from github.com via github connect or manually copying the repo to their GHES instance.

    • Few dependencies and cache action usage examples have also been updated.


    Configuration

    📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

    🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

    Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

    🔕 Ignore: Close this PR and you won't be reminded about this update again.


    • [ ] If you want to rebase/retry this PR, check this box

    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 6
  • Dependency Dashboard

    Dependency Dashboard

    This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

    Open

    These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

    Detected dependencies

    composer
    build/composer.json
    • voku/php-readme-helper ~0.6
    composer.json
    • php >=7.0.0
    • phpunit/phpunit ~6.0 || ~7.0 || ~9.0
    github-actions
    .github/workflows/ci.yml
    • actions/checkout v3
    • shivammathur/setup-php 2.17.1
    • actions/cache v2.1.7
    • codecov/codecov-action v2
    • actions/upload-artifact v3

    • [ ] Check this box to trigger a request for Renovate to run again on this repository
    opened by renovate[bot] 0
Owner
Lars Moelleken
Webdeveloper & Sysadmin | egrep '#php|#js|#html|#css|#sass'
Lars Moelleken
:accept: Stringy - A PHP string manipulation library with multibyte support, performance optimized

?? Stringy A PHP string manipulation library with multibyte support. Compatible with PHP 7+ 100% compatible with the original "Stringy" library, but t

Lars Moelleken 144 Dec 12, 2022
A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

URLify for PHP A fast PHP slug generator and transliteration library, started as a PHP port of URLify.js from the Django project. Handles symbols from

Aband*nthecar 667 Dec 20, 2022
ATOMASTIC 14 Mar 12, 2022
Extensive, portable and performant handling of UTF-8 and grapheme clusters for PHP

Patchwork UTF-8 for PHP Patchwork UTF-8 gives PHP developpers extensive, portable and performant handling of UTF-8 and grapheme clusters. It provides

Nicolas Grekas 80 Sep 28, 2022
A PHP string manipulation library with multibyte support. Compatible with PHP 5.4+, PHP 7+, and HHVM.

A PHP string manipulation library with multibyte support. Compatible with PHP 5.4+, PHP 7+, and HHVM. s('string')->toTitleCase()->ensureRight('y') ==

Daniel St. Jules 2.5k Dec 28, 2022
A PHP string manipulation library with multibyte support

A PHP string manipulation library with multibyte support. Compatible with PHP 5.4+, PHP 7+, and HHVM. s('string')->toTitleCase()->ensureRight('y') ==

Daniel St. Jules 2.5k Jan 3, 2023
PHP library to parse urls from string input

Url highlight - PHP library to parse URLs from string input. Works with complex URLs, edge cases and encoded input. Features: Replace URLs in string b

Volodymyr Stelmakh 77 Sep 16, 2022
A language detection library for PHP. Detects the language from a given text string.

language-detection Build Status Code Coverage Version Total Downloads Minimum PHP Version License This library can detect the language of a given text

Patrick Schur 738 Dec 28, 2022
Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

Motto: "Every business should have a detection script to detect mobile readers." About Mobile Detect is a lightweight PHP class for detecting mobile d

Şerban Ghiţă 10.2k Jan 4, 2023
Converts a string to a slug. Includes integrations for Symfony, Silex, Laravel, Zend Framework 2, Twig, Nette and Latte.

cocur/slugify Converts a string into a slug. Developed by Florian Eckerstorfer in Vienna, Europe with the help of many great contributors. Features Re

Cocur 2.8k Dec 22, 2022
A sane interface for php's built in preg_* functions

Making regex great again Php's built in preg_* functions require some odd patterns like passing variables by reference and treating false or null valu

Spatie 1.1k Jan 4, 2023
A PHP class which allows the decoding and encoding of a wider variety of characters compared to the standard htmlentities and html_entity_decode functions.

The ability to encode and decode a certain set of characters called 'Html Entities' has existed since PHP4. Amongst the vast number of functions built into PHP, there are 4 nearly identical functions that are used to encode and decode html entities; despite their similarities, however, 2 of them do provide additional capabilities not available to the others.

Gavin G Gordon (Markowski) 2 Nov 12, 2022
SNIA SSS PTS test suite based on SNIA's Solid State Storage Performance Test Specification for Transcend products

SNIA-SSS-PTS ABSTRACT SNIA SSS PTS describes a solid state storage device-level performance test methodology, test suite and reporting format intended

Transcend Information, Inc. 6 Nov 2, 2022
A PHP library for generating universally unique identifiers (UUIDs).

ramsey/uuid A PHP library for generating and working with UUIDs. ramsey/uuid is a PHP library for generating and working with universally unique ident

Ben Ramsey 11.9k Jan 8, 2023
ColorJizz is a PHP library for manipulating and converting colors.

#Getting started: ColorJizz-PHP uses the PSR-0 standards for namespaces, so there should be no trouble using with frameworks like Symfony 2. ###Autolo

Mikeemoo 281 Nov 25, 2022
PHP library to detect and manipulate indentation of strings and files

indentation PHP library to detect and manipulate the indentation of files and strings Installation composer require --dev colinodell/indentation Usage

Colin O'Dell 34 Nov 28, 2022
The Universal Device Detection library will parse any User Agent and detect the browser, operating system, device used (desktop, tablet, mobile, tv, cars, console, etc.), brand and model.

DeviceDetector Code Status Description The Universal Device Detection library that parses User Agents and detects devices (desktop, tablet, mobile, tv

Matomo Analytics 2.4k Jan 5, 2023
Library for free use Google Translator. With attempts connecting on failure and array support.

GoogleTranslateForFree Packagist: https://packagist.org/packages/dejurin/php-google-translate-for-free Library for free use Google Translator. With at

Yurii De 122 Dec 23, 2022
Text - Simple 1 Class Text Manipulation Library

Text - Simple 1 Class Text Manipulation Library Do you remember PHP's string functions? If not, just wrap you text with Text! It will save a minute on

Kazuyuki Hayashi 51 Nov 16, 2021