{"id":28517524,"url":"https://github.com/invokable/laravel-str-mixins","last_synced_at":"2026-03-11T04:03:39.982Z","repository":{"id":45008351,"uuid":"300147867","full_name":"invokable/laravel-str-mixins","owner":"invokable","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-22T00:12:30.000Z","size":82,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-22T08:25:25.720Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/revolution/laravel-str-mixins","language":"PHP","has_issues":false,"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/invokable.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["invokable"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2020-10-01T04:52:29.000Z","updated_at":"2026-02-22T00:12:34.000Z","dependencies_parsed_at":"2024-03-14T10:27:42.973Z","dependency_job_id":"6806e46e-eae9-4305-aae3-db042068527c","html_url":"https://github.com/invokable/laravel-str-mixins","commit_stats":{"total_commits":39,"total_committers":3,"mean_commits":13.0,"dds":0.07692307692307687,"last_synced_commit":"43ad1b0645566fd1e5c8025dbe8a466f43ca1fe0"},"previous_names":["invokable/laravel-str-mixins","kawax/laravel-str-mixins"],"tags_count":27,"template":false,"template_full_name":null,"purl":"pkg:github/invokable/laravel-str-mixins","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invokable%2Flaravel-str-mixins","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invokable%2Flaravel-str-mixins/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invokable%2Flaravel-str-mixins/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invokable%2Flaravel-str-mixins/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/invokable","download_url":"https://codeload.github.com/invokable/laravel-str-mixins/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invokable%2Flaravel-str-mixins/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30370284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T21:41:54.280Z","status":"online","status_checked_at":"2026-03-11T02:00:07.027Z","response_time":84,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-06-09T05:08:44.829Z","updated_at":"2026-03-11T04:03:39.977Z","avatar_url":"https://github.com/invokable.png","language":"PHP","funding_links":["https://github.com/sponsors/invokable"],"categories":[],"sub_categories":[],"readme":"# Laravel Str mixins\n\nMixin that extends `Illuminate\\Support\\Str` mainly for Japanese language use\n\n## Requirements\n- PHP \u003e= 8.3\n- Laravel \u003e= 12.0\n\n## Versioning\n\n| ver                                                             | PHP  | Laravel |\n|-----------------------------------------------------------------|------|---------|\n| [1.x](https://github.com/invokable/laravel-str-mixins/tree/1.x) | ^7.2 | 6       |\n| 2.x                                                             | ^8.3 | ^12   |\n\n- v1.x is for Laravel 6 only.\n- v2.x supports Laravel 7 and above only for Fluent Strings.\n\n## Installation\n```shell\ncomposer require revolution/laravel-str-mixins\n```\n\n### Uninstall\n```shell\ncomposer remove revolution/laravel-str-mixins\n```\n\n## Str\n\n### Str::textwrap(string $str, int $width = 10, string $break = PHP_EOL): string\nLine breaks at specified number of characters. Simple line breaks without word-wrapping rules.\n\n```php\n$text = Str::textwrap(str: 'abcde', width: 3);\n\n// abc\n// de\n```\n\nOriginally intended for forcing line breaks to fit within OGP image width.\n\nChanged to `textwrap` because Laravel 10.19.0 added a function with the same name `Str::wordWrap()`. Kept instead of removing because the behavior is different. `Str::wordWrap()` doesn't work as expected with Japanese text.\n\n### Str::kana(string $str, string $option = 'KV', string $encoding = 'UTF-8'): string\nSame as `mb_convert_kana()`.\n\n```php\n$text = Str::kana(str: 'abｃあいうｱｲｳ', option: 'KVa');\n\n// abcあいうアイウ\n```\n\n### Str::truncate(string $str, int $limit = 100, string $end = '...'): string\n`Str::limit()` counts half-width characters as 1 and full-width characters as 2 when truncating. It uses multibyte functions but counts by character width.\n\n```php\n$text = Str::limit('abcあいうえお', 7);\n\n// abcあい...\n```\n\n`Str::truncate()` counts by the number of characters for truncation, which works better for Japanese text.\n\n```php\n$text = Str::truncate(str: 'abcあいうえお', limit: 7);\n\n// abcあいうえ...\n```\n\n## Fluent Strings\n\n### textwrap(int $width = 10, string $break = PHP_EOL): Stringable\n\n```php\n$text = Str::of('abcde')-\u003etextwrap(width: 3)-\u003evalue();\n\n// abc\n// de\n```\n\n### kana(string $option = 'KV', string $encoding = 'UTF-8'): Stringable\n\n```php\n$text = Str::of('abｃあいうｱｲｳ')-\u003ekana(option: 'KVa')-\u003evalue();\n\n// abcあいうアイウ\n```\n\nFor chaining use:\n\n```php\n$text = Str::of('abｃあいうｱｲｳ')-\u003ekana(option: 'KVa')-\u003etextwrap(3)-\u003evalue();\n\n// abc\n// あいう\n// アイウ\n```\n\n### truncate(int $limit = 100, string $end = '...'): Stringable\n```php\n$text = Str::of('abcあいうえお')-\u003etruncate(limit: 6, end: '___')-\u003evalue();\n\n// abcあいう___\n```\n\n## LICENSE\nMIT      \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvokable%2Flaravel-str-mixins","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finvokable%2Flaravel-str-mixins","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvokable%2Flaravel-str-mixins/lists"}