{"id":17191645,"url":"https://github.com/fab2s/utf8","last_synced_at":"2025-04-13T19:53:23.856Z","repository":{"id":56980950,"uuid":"201897395","full_name":"fab2s/Utf8","owner":"fab2s","description":"A purely static UTF-8 Helper based on mb_string and ext-intl","archived":false,"fork":false,"pushed_at":"2022-09-27T18:36:37.000Z","size":17,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T14:10:39.366Z","etag":null,"topics":["helper","intl","mb-string","nfc","nfd","normalization","php","simple","utf-8"],"latest_commit_sha":null,"homepage":null,"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/fab2s.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-12T09:17:56.000Z","updated_at":"2022-11-20T17:35:52.000Z","dependencies_parsed_at":"2022-08-21T08:40:32.298Z","dependency_job_id":null,"html_url":"https://github.com/fab2s/Utf8","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fab2s%2FUtf8","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fab2s%2FUtf8/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fab2s%2FUtf8/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fab2s%2FUtf8/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fab2s","download_url":"https://codeload.github.com/fab2s/Utf8/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248774195,"owners_count":21159526,"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":["helper","intl","mb-string","nfc","nfd","normalization","php","simple","utf-8"],"created_at":"2024-10-15T01:26:56.444Z","updated_at":"2025-04-13T19:53:23.835Z","avatar_url":"https://github.com/fab2s.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Utf8\n\n[![Build Status](https://travis-ci.com/fab2s/Utf8.svg?branch=master)](https://travis-ci.com/fab2s/Utf8) [![Total Downloads](https://poser.pugx.org/fab2s/utf8/downloads)](//packagist.org/packages/fab2s/utf8) [![Monthly Downloads](https://poser.pugx.org/fab2s/utf8/d/monthly)](//packagist.org/packages/fab2s/utf8) [![Latest Stable Version](https://poser.pugx.org/fab2s/utf8/v/stable)](https://packagist.org/packages/fab2s/utf8) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/fab2s/Utf8/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/fab2s/Utf8/?branch=master) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)](http://makeapullrequest.com) [![License](https://poser.pugx.org/fab2s/utf8/license)](https://packagist.org/packages/fab2s/utf8)\n\nA purely static UTF-8 Helper based on [mb_string](https://php.net/mb_string) and [ext-intl](https://php.net/intl)\n\n\u003e For sure this is not new, and there is better out there, but this is small and does the job without a lot of noise\n\n## Installation\n\n`Utf8` can be installed using composer:\n\n```\ncomposer require \"fab2s/utf8\"\n```\n\n`Utf8` is also included in [OpinHelper](https://github.com/fab2s/OpinHelpers) which packages several bellow \"Swiss Army Knife\" level Helpers covering some of the most annoying aspects of php programing, such as UTF8 string manipulation, high precision Mathematics or properly locking a file\n\nShould you need to work with php bellow 7.1, you can still use [OpinHelper](https://github.com/fab2s/OpinHelpers) `0.x`\n\n## Prerequisites\n\n`Utf8` requires [mb_string](https://php.net/mb_string), [ext-intl](https://php.net/intl) is auto detected and used when available for UTF-8 Normalization\n\n## In practice\n\n`Utf8` offers replacement for most native string functions with support for UTF-8:\n\n- `Utf8::strrpos(string string $str, string $needle, int $offset = null):int|false`\n    \n    UTF-8 aware [strrpos()](https://php.net/strrpos) replacement\n\n- `Utf8::strpos(string $str, string $needle, int $offset = 0):int|false` \n    \n    UTF-8 aware [strpos()](https://php.net/strpos) replacement\n\n- `Utf8::strtolower(string $str):string`\n    \n    UTF-8 aware [strtolower()](https://php.net/strtolower) replacement\n\n- `Utf8::strtoupper(string $str):string`\n    \n    UTF-8 aware [strtoupper()](https://php.net/strtoupper) replacement\n\n- `Utf8::substr(string $str, int $offset, int $length = null):string`\n    \n    UTF-8 aware [substr()](https://php.net/substr) replacement\n\n- `Utf8::strlen(string $str):int`\n    \n    UTF-8 aware [strlen()](https://php.net/strlen) replacement\n\n- `Utf8::ucfirst(string $str):string`\n    \n    UTF-8 aware [ucfirst()](https://php.net/ucfirst) replacement\n\n- `Utf8::ucwords(string $str):string`\n    \n    UTF-8 aware [ucwords()](https://php.net/ucwords) replacement\n\n- `Utf8::ord(string $chr):int|false`\n    \n    UTF-8 aware [ord()](https://php.net/ord) replacement\n\n- `Utf8::chr(int $num):string|false`\n    \n    UTF-8 aware [chr()](https://php.net/chr) replacement\n\nAnd some simple utility methods:\n\n- `Utf8::normalize(string $string, int $canonicalForm = self::NORMALIZE_NFC):string`\n    \n    UTF-8 [ext-intl](https://php.net/intl) [Normalizer](https://php.net/normalizer.normalize)\n    \u003e **WARNING**: This method will do nothing in case `ext-intl` is not installed on the host\n    \u003e This means it is up to you to make sure about it using `Utf8::normalizerSupport` \n    \u003e or by adding `ext-intl` as a requirement to your project's `composer.json` file\n\n- `Utf8::hasUtf8(string $string):bool`\n    \n    Tells if the input string contains some UTF-8\n\n- `Utf8::isUtf8(string $string):bool`\n    \n    Tells if the input string is valid UTF-8\n\n- `Utf8::replaceMb4(string $string, string $replace = ''):string`\n    \n    Replaces all [Utf8Mb4](https://stackoverflow.com/a/30074553/7630496) characters (aka mostly [emoji](https://en.wikipedia.org/wiki/Emoji))\n\n- `Utf8::normalizerSupport(bool $disable = false):bool`\n    \n    Tells if [Normalizer](https://php.net/normalizer.normalize) is available or disable Normalizer support\n\n## Requirements\n\n`Utf8` is tested against php 7.2, 7.3, 7.4, 8.0 and 8.1\n\n## Contributing\n\nContributions are welcome, do not hesitate to open issues and submit pull requests.\n\n## License\n\n`Utf8` is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffab2s%2Futf8","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffab2s%2Futf8","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffab2s%2Futf8/lists"}