{"id":19044185,"url":"https://github.com/sevenecks/string-utils","last_synced_at":"2026-05-14T01:39:48.056Z","repository":{"id":62542743,"uuid":"114009475","full_name":"sevenecks/string-utils","owner":"sevenecks","description":"PHP String Utility Package loosely based on LambdaMOO $string_utils package. Useful for formatting strings for logs and terminal output.","archived":false,"fork":false,"pushed_at":"2018-10-18T20:08:17.000Z","size":125,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-21T23:18:00.334Z","etag":null,"topics":["formatting","lambdamoo","logging","php","string","terminal"],"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/sevenecks.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-12T15:53:17.000Z","updated_at":"2018-10-18T20:08:19.000Z","dependencies_parsed_at":"2022-11-02T15:46:35.818Z","dependency_job_id":null,"html_url":"https://github.com/sevenecks/string-utils","commit_stats":null,"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/sevenecks/string-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevenecks%2Fstring-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevenecks%2Fstring-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevenecks%2Fstring-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevenecks%2Fstring-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sevenecks","download_url":"https://codeload.github.com/sevenecks/string-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sevenecks%2Fstring-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33006742,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"ssl_error","status_checked_at":"2026-05-13T13:14:51.610Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["formatting","lambdamoo","logging","php","string","terminal"],"created_at":"2024-11-08T22:45:09.079Z","updated_at":"2026-05-14T01:39:48.027Z","avatar_url":"https://github.com/sevenecks.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StringUtils\n\nA set of common string functions, loosely based on LambdaMOO $string_utils. It uses [sevenecks/ansi](https://github.com/SevenEcks/ansi) to add color where applicable though you can pass your own colorizer in via dependency injection.\n\n## Installation\n\nVia Composer\n\n```bash\ncomposer require sevenecks/string-utils\n```\n\n## Usage\n\n```php\nrequire_once __DIR__ . '/../vendor/autoload.php';\nuse SevenEcks\\StringUtils\\StringUtils;\nuse SevenEcks\\Ansi\\Colorize;\n\n$su = new StringUtils;\n$test_string = 'This is a test';\n// echo out test string\n$su-\u003etell($test_string);\n$su-\u003esetLineLength(10);\n// echo out a string, ignores line len\n$su-\u003etell($su-\u003ecolorize-\u003ered(\"This is a test of a long red string!\"));\n$su-\u003esetSplitMidWord(true);\n// echo using line length and color color\n$su-\u003etell($su-\u003ecolorize-\u003ered($su-\u003ewordWrap(\"This is a test of a long blue word wrapped string which breaks mid word!\")));\n$su-\u003esetSplitMidWord(false);\n// echo using length and color color\n$su-\u003etell($su-\u003ecolorize-\u003eblue($su-\u003ewordWrap(\"This is a test of a long blue word wrapped string which breaks at a word!\")));\n// set the line length break string to br instead of default of \\n\n$su-\u003esetBreakString(\"\u003cbr /\u003e\");\n$su-\u003etell($su-\u003ecolorize-\u003ered($su-\u003ewordWrap(\"This is a test of a long red string!\")));\n$su-\u003etell(\"Not colored.\");\n// mass colorize a string wrapped by line\n$su-\u003etell_lines($su-\u003emassColor($su-\u003elineWrap(\"This is a test of a long line wrapped red strings!\"), 'blue'));\n// break at specific linelen\n$su-\u003etell_lines($su-\u003elineWrap('123456789123456789123456789'));\n// formatting of left, right, and center\n$su-\u003etell($su-\u003eleft(\"TEST\", 10) . $su-\u003eleft(\"TEST1\", 10));\n$su-\u003etell($su-\u003eright(\"TEST\", 10) . $su-\u003eright(\"TEST1\", 10));\n$su-\u003etell($su-\u003ecenter(\"TEST\", 10) . $su-\u003ecenter(\"TEST1\", 10));\n// update line len\n$su-\u003esetLineLength(180);\n// center\n$su-\u003etell($su-\u003ecenter(\"CENTER NO ARGS\"));\n$su-\u003etell($su-\u003ecenter(\"CENTER W/ ARGS\", 30));\n// alerts crits and warnings for debugging\n$su-\u003ealert(\"This is an alert!\");\n$su-\u003ewarning(\"This is a warning\");\n$su-\u003ecritical(\"This is critical!\");\n// using tostr to combine args into a string\n$su-\u003etell($su-\u003etostr($su-\u003ecenter(\"THIS EXAMPLE\", 10), ' ', $su-\u003ecenter(\"USES TOSTR\", 10), ' ', 1,2,3));\n$su-\u003etell($su-\u003etostr('1',2,'3','asdf',['a', 'b' =\u003e 'c', 1]));\n```\n![Example Output](https://github.com/SevenEcks/string-utils/blob/master/images/example.png \"Example Output\")\n\n## Change Log\nPlease see [Change Log](CHANGELOG.md) for more information.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsevenecks%2Fstring-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsevenecks%2Fstring-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsevenecks%2Fstring-utils/lists"}