{"id":21467444,"url":"https://github.com/elusivecodes/fyrestring","last_synced_at":"2025-07-15T05:31:30.979Z","repository":{"id":62508441,"uuid":"304625164","full_name":"elusivecodes/FyreString","owner":"elusivecodes","description":"FyreString is a free, open-source string utility library for PHP.","archived":false,"fork":false,"pushed_at":"2024-06-29T01:39:57.000Z","size":105,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-09-03T05:49:31.303Z","etag":null,"topics":["php","string","text","utility"],"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/elusivecodes.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}},"created_at":"2020-10-16T12:46:43.000Z","updated_at":"2024-06-29T01:39:50.000Z","dependencies_parsed_at":"2024-06-29T02:38:44.750Z","dependency_job_id":"c7f30c9d-47a0-4216-be4b-a265b7d54d52","html_url":"https://github.com/elusivecodes/FyreString","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreString","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreString/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreString/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreString/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elusivecodes","download_url":"https://codeload.github.com/elusivecodes/FyreString/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226017581,"owners_count":17560539,"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":["php","string","text","utility"],"created_at":"2024-11-23T08:18:07.842Z","updated_at":"2024-11-23T08:18:09.096Z","avatar_url":"https://github.com/elusivecodes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FyreString\r\n\r\n**FyreString** is a free, open-source string manipulation library for *PHP*.\r\n\r\n\r\n## Table Of Contents\r\n- [Installation](#installation)\r\n- [Methods](#methods)\r\n\r\n\r\n\r\n## Installation\r\n\r\n**Using Composer**\r\n\r\n```\r\ncomposer require fyre/string\r\n```\r\n\r\nIn PHP:\r\n\r\n```php\r\nuse Fyre\\Utility\\Str;\r\n```\r\n\r\n\r\n## Methods\r\n\r\n**After**\r\n\r\nGet the contents of a string after the first occurrence of a substring.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to search for.\r\n\r\n```php\r\n$after = Str::after($string, $search);\r\n```\r\n\r\nIf the `search` string is not found, this method will return the original string.\r\n\r\n**After Last**\r\n\r\nGet the contents of a string after the last occurrence of a substring.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to search for.\r\n\r\n```php\r\n$afterLast = Str::afterLast($string, $search);\r\n```\r\n\r\nIf the `search` string is not found, this method will return the original string.\r\n\r\n**Before**\r\n\r\nGet the contents of a string before the first occurrence of a substring.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to search for.\r\n\r\n```php\r\n$before = Str::before($string, $search);\r\n```\r\n\r\nIf the `search` string is not found, this method will return an empty string.\r\n\r\n**Before Last**\r\n\r\nGet the contents of a string before the last occurrence of a substring.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to search for.\r\n\r\n```php\r\n$beforeLast = Str::beforeLast($string, $search);\r\n```\r\n\r\nIf the `search` string is not found, this method will return an empty string.\r\n\r\n**Camel**\r\n\r\nConvert a string into camelCase.\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$camel = Str::camel($string);\r\n```\r\n\r\n**Capitalize**\r\n\r\nCapitalize the first character of a string.\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$capitalized = Str::capitalize($string);\r\n```\r\n\r\n**Chunk**\r\n\r\nSplit a string into smaller chunks.\r\n\r\n- `$string` is the input string.\r\n- `$size` is a number representing the maximum length of a chunk, and will default to *1*.\r\n\r\n```php\r\n$chunks = Str::chunks($string, $size);\r\n```\r\n\r\n**Contains**\r\n\r\nDetermine whether a string contains a substring.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to search for.\r\n\r\n```php\r\n$contains = Str::contains($string, $search);\r\n```\r\n\r\n**Contains All**\r\n\r\nDetermine whether a string contains all substrings.\r\n\r\n- `$string` is the input string.\r\n- `$searches` is an array containing search strings.\r\n\r\n```php\r\n$containsAll = Str::containsAll($string, $searches);\r\n```\r\n\r\n**Contains Any**\r\n\r\nDetermine whether a string contains any substring.\r\n\r\n- `$string` is the input string.\r\n- `$searches` is an array containing search strings.\r\n\r\n```php\r\n$containsAny = Str::containsAny($string, $searches);\r\n```\r\n\r\n**End**\r\n\r\nAppend a substring to a string (if it does not already end with the substring).\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to append.\r\n\r\n```php\r\n$end = Str::end($string, $search);\r\n```\r\n\r\n**Ends With**\r\n\r\nDetermine whether a string ends with a substring.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to search for.\r\n\r\n```php\r\n$endsWith = Str::endsWith($string, $search);\r\n```\r\n\r\n**Escape**\r\n\r\nEscape characters in a string for use in HTML.\r\n\r\n- `$string` is the input string.\r\n- `$flags` is a number representing the flags to use when escaping, and will default to *Str::ENT_QUOTES | Str::ENT_HTML5*.\r\n\r\n```php\r\n$escaped = Str::escape($string, $flags);\r\n```\r\n\r\n**Index Of**\r\n\r\nGet the position of the first occurrence of a substring within a string.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to search for.\r\n- `$start` is a number representing the starting offset, and will default to *0*.\r\n\r\n```php\r\n$indexOf = Str::indexOf($string, $search);\r\n```\r\n\r\nIf the `search` string is not found, this method will return *-1*.\r\n\r\n**Is String**\r\n\r\nDetermine whether the value is a string.\r\n\r\n- `$value` is the value to test.\r\n\r\n```php\r\n$isString = Str::isString($value);\r\n```\r\n\r\n**Kebab**\r\n\r\nConvert a string into kebab-case.\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$kebab = Str::kebab($string);\r\n```\r\n\r\n**Last Index Of**\r\n\r\nGet the position of the last occurrence of a substring within a string.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to search for.\r\n- `$start` is a number representing the starting offset, and will default to *0*.\r\n\r\n```php\r\n$lastIndexOf = Str::lastIndexOf($string, $search);\r\n```\r\n\r\nIf the `search` string is not found, this method will return *-1*.\r\n\r\n**Length**\r\n\r\nGet the length of a string (in bytes).\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$length = Str::length($string);\r\n```\r\n\r\n**Limit**\r\n\r\nLimit a string to a specified number of bytes.\r\n\r\n- `$string` is the input string.\r\n- `$limit` is a number representing the number of bytes to split the string after.\r\n- `$append` is a string representing the value to append if the string is split, and will default to \"*…*\".\r\n\r\n```php\r\n$limited = Str::limit($string, $limit, $append);\r\n```\r\n\r\n**Lower**\r\n\r\nConvert a string into lowercase.\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$lower = Str::lower($string);\r\n```\r\n\r\n**Pad**\r\n\r\nPad a string to a specified length.\r\n\r\n- `$string` is the input string.\r\n- `$length` is a number representing the desired length.\r\n- `$padding` is a string representing the padding to use, and will default to *\" \"*.\r\n\r\n```php\r\n$padded = Str::pad($string, $length, $padding);\r\n```\r\n\r\n**Pad End**\r\n\r\nPad the end of a string to a specified length.\r\n\r\n- `$string` is the input string.\r\n- `$length` is a number representing the desired length.\r\n- `$padding` is a string representing the padding to use, and will default to *\" \"*.\r\n\r\n```php\r\n$padded = Str::padEnd($string, $length, $padding);\r\n```\r\n\r\n**Pad Start**\r\n\r\nPad the start of a string to a specified length.\r\n\r\n- `$string` is the input string.\r\n- `$length` is a number representing the desired length.\r\n- `$padding` is a string representing the padding to use, and will default to *\" \"*.\r\n\r\n```php\r\n$padded = Str::padStart($string, $length, $padding);\r\n```\r\n\r\n**Pascal**\r\n\r\nConvert a string into PascalCase.\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$pascal = Str::pascal($string);\r\n```\r\n\r\n**Random**\r\n\r\nGenerate a random string.\r\n\r\n- `$length` is the length of the string to generate, and will default to *16*.\r\n- `$chars` is a string representing the characters to use, and will default to \"*abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWYXZ0123456789*\".\r\n\r\n```php\r\n$random = Str::random($length, $chars);\r\n```\r\n\r\n**Repeat**\r\n\r\nRepeat a string a specified number of times.\r\n\r\n- `$string` is the input string.\r\n- `$count` is a number representing the number of times to repeat the string.\r\n\r\n```php\r\n$repeated = Str::repeat($string, $count);\r\n```\r\n\r\n**Replace**\r\n\r\nSearch and replace a value within a string.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to replace.\r\n- `$replace` is a string representing the replacement value.\r\n\r\n```php\r\n$replaced = Str::replace($string, $search, $replace);\r\n```\r\n\r\n**Replace Array**\r\n\r\nSearch and replace a value within a string.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to replace.\r\n- `$replacements` is an array containing replacement strings.\r\n\r\n```php\r\n$replaced = Str::replaceArray($string, $search, $replacements);\r\n```\r\n\r\n**Replace At**\r\n\r\nReplace text within a portion of a string.\r\n\r\n- `$string` is the input string.\r\n- `$replace` is a string representing the replacement value.\r\n- `$position` is a number representing the position to replace from.\r\n- `$length` is a number representing the length to replace.\r\n\r\n```php\r\n$replaced = Str::replaceAt($string, $replace, $position, $length);\r\n```\r\n\r\n**Replace Each**\r\n\r\n Search and replace key/value pairs within a string.\r\n\r\n- `$string` is the input string.\r\n- `$replacements` is an array containing replacements.\r\n\r\n```php\r\n$replaced = Str::replaceEach($string, $replacements);\r\n```\r\n\r\n**Replace First**\r\n\r\nSearch and replace the first occurrence of a value within a string.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to replace.\r\n- `$replace` is a string representing the replacement value.\r\n\r\n```php\r\n$replaced = Str::replaceFirst($string, $search, $replace);\r\n```\r\n\r\n**Replace Last**\r\n\r\nSearch and replace the last occurrence of a value within a string.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to replace.\r\n- `$replace` is a string representing the replacement value.\r\n\r\n```php\r\n$replaced = Str::replaceLast($string, $search, $replace);\r\n```\r\n\r\n**Reverse**\r\n\r\nReverse the contents of a string.\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$reversed = Str::reverse($string);\r\n```\r\n\r\n**Shuffle**\r\n\r\nShuffle the contents of a string.\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$shuffled = Str::shuffle($string);\r\n```\r\n\r\n**Slice**\r\n\r\nReturn a specified portion of a string.\r\n\r\n- `$string` is the input string.\r\n- `$start` is a number representing the starting offset.\r\n- `$length` is a number representing the maximum length to return, and will default to *PHP_INT_MAX*.\r\n\r\n```php\r\n$sliced = Str::slice($string, $start, $length);\r\n```\r\n\r\n**Slug**\r\n\r\nFormat a string for use in a URL.\r\n\r\n- `$string` is the input string.\r\n- `$delimiter` is a string representing the delimiter to use, and will default to *\"_\"*.\r\n\r\n```php\r\n$slug = Str::slug($string, $delimiter);\r\n```\r\n\r\n**Snake**\r\n\r\nConvert a string into snake_case.\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$snake = Str::snake($string);\r\n```\r\n\r\n**Split**\r\n\r\nSplit a string by a specified delimiter.\r\n\r\n- `$string` is the input string.\r\n- `$delimiter` is a string representing the delimiter to split by.\r\n- `$limit` is a number representing the maximum number of substrings to return, and will default to *PHP_INT_MAX*.\r\n\r\n```php\r\n$split = Str::split($string, $delimiter, $limit);\r\n```\r\n\r\n**Start**\r\n\r\nPrepend a substring to a string (if it does not already begin with the substring).\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to prepend.\r\n\r\n```php\r\n$start = Str::start($string, $search);\r\n```\r\n\r\n**Starts With**\r\n\r\nDetermine whether a string begins with a substring.\r\n\r\n- `$string` is the input string.\r\n- `$search` is a string representing the value to search for.\r\n\r\n```php\r\n$startsWith = Str::startsWith($string, $search);\r\n```\r\n\r\n**Title**\r\n\r\nCapitalize the first character of each word in a string.\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$title = Str::title($string);\r\n```\r\n\r\n**Transliterate**\r\n\r\nTransliterate the characters of a string into ASCII.\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$transliterated = Str::transliterate($string);\r\n```\r\n\r\n**Trim**\r\n\r\nTrim whitespace (or other characters) from the start and end of a string.\r\n\r\n- `$string` is the input string.\r\n- `$mask` is a string representing the characters to trim, and will default to *\" \\t\\n\\r\\0\\x0B\"*.\r\n\r\n```php\r\n$trimmed = Str::trim($string, $mask);\r\n```\r\n\r\n**Trim End**\r\n\r\nTrim whitespace (or other characters) from the end of a string.\r\n\r\n- `$string` is the input string.\r\n- `$mask` is a string representing the characters to trim, and will default to *\\\" t\\n\\r\\0\\x0B\"*.\r\n\r\n```php\r\n$trimmed = Str::trimEnd($string, $mask);\r\n```\r\n\r\n**Trim Start**\r\n\r\nTrim whitespace (or other characters) from the start of a string.\r\n\r\n- `$string` is the input string.\r\n- `$mask` is a string representing the characters to trim, and will default to \" *\\t\\n\\r\\0\\x0B*\".\r\n\r\n```php\r\n$trimmed = Str::trimStart($string, $mask);\r\n```\r\n\r\n**Upper**\r\n\r\nConvert a string into uppercase.\r\n\r\n- `$string` is the input string.\r\n\r\n```php\r\n$upper = Str::upper($string);\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyrestring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felusivecodes%2Ffyrestring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyrestring/lists"}