{"id":15025850,"url":"https://github.com/jfcherng/php-mb-string","last_synced_at":"2025-03-17T15:12:23.793Z","repository":{"id":56998623,"uuid":"138495215","full_name":"jfcherng/php-mb-string","owner":"jfcherng","description":"An implementation targeting high performance for frequently reading/writing operations for multi-byte string.","archived":false,"fork":false,"pushed_at":"2024-11-06T16:49:14.000Z","size":222,"stargazers_count":11,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T01:49:24.614Z","etag":null,"topics":["mbstring","multibyte-strings","php-71","psr-1","psr-2","psr-4","string","utf-32","utf-8"],"latest_commit_sha":null,"homepage":"","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/jfcherng.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://www.paypal.me/jfcherng/5usd"}},"created_at":"2018-06-24T15:54:08.000Z","updated_at":"2025-01-14T12:54:48.000Z","dependencies_parsed_at":"2024-06-19T00:03:44.044Z","dependency_job_id":"1344dab8-8cad-4221-90d0-d1e04512b885","html_url":"https://github.com/jfcherng/php-mb-string","commit_stats":{"total_commits":97,"total_committers":1,"mean_commits":97.0,"dds":0.0,"last_synced_commit":"8407bfefde47849c9e7c9594e6de2ac85a0f845d"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfcherng%2Fphp-mb-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfcherng%2Fphp-mb-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfcherng%2Fphp-mb-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jfcherng%2Fphp-mb-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jfcherng","download_url":"https://codeload.github.com/jfcherng/php-mb-string/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244056425,"owners_count":20390719,"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":["mbstring","multibyte-strings","php-71","psr-1","psr-2","psr-4","string","utf-32","utf-8"],"created_at":"2024-09-24T20:03:09.676Z","updated_at":"2025-03-17T15:12:23.773Z","avatar_url":"https://github.com/jfcherng.png","language":"PHP","funding_links":["https://www.paypal.me/jfcherng/5usd"],"categories":[],"sub_categories":[],"readme":"# php-mb-string\n\n[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/jfcherng/php-mb-string/php.yml?branch=master\u0026style=flat-square)](https://github.com/jfcherng/php-mb-string/actions)\n[![Packagist](https://img.shields.io/packagist/dt/jfcherng/php-mb-string?style=flat-square)](https://packagist.org/packages/jfcherng/php-mb-string)\n[![Packagist Version](https://img.shields.io/packagist/v/jfcherng/php-mb-string?style=flat-square)](https://packagist.org/packages/jfcherng/php-mb-string)\n[![Project license](https://img.shields.io/github/license/jfcherng/php-mb-string?style=flat-square)](https://github.com/jfcherng/php-mb-string/blob/master/LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/jfcherng/php-mb-string?style=flat-square\u0026logo=github)](https://github.com/jfcherng/php-mb-string/stargazers)\n[![Donate to this project using Paypal](https://img.shields.io/badge/paypal-donate-blue.svg?style=flat-square\u0026logo=paypal)](https://www.paypal.me/jfcherng/5usd)\n\nA high performance multibyte sting implementation for frequently reading/writing operations.\n\n## Why I Write This Package?\n\nConsider that you have a **LONG** multibyte string and\nyou want to do lots of following operations on it.\n\n- Random reading/writing such as `$char = $str[5];` or `$str[5] = '許';`.\n- Replacement such as `str_replace($search, $replace, $str);`.\n- Insertion such as `substr_replace($insert, $str, $position, 0);`.\n- Get substring such as `substr($str, $start, $length);`.\n\nBecause strings in PHP are not UTF-8, to do operations above safely,\nyou have to either use `mb_*()` functions or calculate the index by yourself.\nUsing `mb_*()` functions frequently can be a performance loss because it has\nto re-decode the source string basing on the given encoding every time when you call it.\nThe longer the string is, the severer the problem becomes.\n\nInstead, this class internally stores the string in its UTF-32 form,\nwhich is fixed-width (1 char always occupies 4 bytes) so we are able to\nperform speedy random accesses. With the power of random access, we could\nuse `str_*()` functions to do the job internally.\n\n## Installation\n\n```bash\ncomposer require jfcherng/php-mb-string\n```\n\n## Example\n\nSee [tests/MbStringTest.php](https://github.com/jfcherng/php-mb-string/blob/master/tests/MbStringTest.php).\n\n## Benchmark\n\nSee [benchmark/\\_results.txt](https://github.com/jfcherng/php-mb-string/blob/master/benchmark/_results.txt).\n\n## What Are You Doing With This Package?\n\nI develop this for a PHP diff package, [jfcherng/php-diff](https://github.com/jfcherng/php-diff).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfcherng%2Fphp-mb-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjfcherng%2Fphp-mb-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjfcherng%2Fphp-mb-string/lists"}