{"id":17104977,"url":"https://github.com/gilbitron/sclr","last_synced_at":"2026-07-14T18:02:36.232Z","repository":{"id":31988335,"uuid":"35558820","full_name":"gilbitron/Sclr","owner":"gilbitron","description":"Supercharge scalar types in PHP","archived":false,"fork":false,"pushed_at":"2015-05-16T10:45:40.000Z","size":122,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-28T15:51:19.821Z","etag":null,"topics":[],"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/gilbitron.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-05-13T15:57:08.000Z","updated_at":"2015-05-16T10:06:25.000Z","dependencies_parsed_at":"2022-08-26T11:51:19.293Z","dependency_job_id":null,"html_url":"https://github.com/gilbitron/Sclr","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gilbitron/Sclr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbitron%2FSclr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbitron%2FSclr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbitron%2FSclr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbitron%2FSclr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gilbitron","download_url":"https://codeload.github.com/gilbitron/Sclr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gilbitron%2FSclr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35472809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-14T02:00:06.603Z","response_time":114,"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":"2024-10-14T15:39:47.051Z","updated_at":"2026-07-14T18:02:36.212Z","avatar_url":"https://github.com/gilbitron.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/gilbitron/Sclr.svg?branch=master)](https://travis-ci.org/gilbitron/Sclr)\n\n# Sclr\nSclr is a library that adds useful Ruby-style methods to scalar types in PHP. It uses a wrapper function \n(much like jQuery's `$()`) to make using Sclr as easy as possible, and even supports method chaining.\n\n## Requirements\n\n* PHP 5.4+\n\n## Install\n\nInstall via [composer](https://getcomposer.org):\n\n```\n{\n    \"require\": {\n        \"gilbitron/sclr\": \"~1.0\"\n    }\n}\n```\n\nRun `composer install` then use as normal:\n\n```php\nrequire 'vendor/autoload.php';\n\n$string = s('hello world')-\u003ecapitalize();\n```\n\n## Usage\n\nUsing Sclr is as simple as passing your value into the `s($value)` function. You can then use any of the API\nmethods below as you wish.\n\n### Strings\n\n* [capitalize()](#capitalize)\n* [capitalizeFirst()](#capitalizefirst)\n* [chars()](#chars)\n* [chop()](#chop)\n* [contains()](#contains)\n* [endsWith()](#endswith)\n* [length()](#length)\n* [lowercase()](#lowercase)\n* [reverse()](#reverse)\n* [startsWith()](#startswith)\n* [uppercase()](#uppercase)\n\n#### capitalize()\n\nUppercase the first character of each word in a string.\n\n```php\ns('hello world')-\u003ecapitalize()\n=\u003e \"Hello World\"\n```\n\nChainable: Yes\n\n#### capitalizeFirst()\n\nMake a string's first character uppercase.\n\n```php\ns('hello world')-\u003ecapitalizeFirst()\n=\u003e \"Hello world\"\n```\n\nChainable: Yes\n\n#### chars()\n\nConvert a string to an array.\n\n```php\ns('hello world')-\u003echars()\n=\u003e ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd']\n```\n\nChainable: No\n\n#### chop()\n\nRemove the last character from a string.\n\n```php\ns('hello world')-\u003echop()\n=\u003e \"hello worl\"\n```\n\nChainable: Yes\n\n#### contains()\n\nTest if the value contains a given string.\n\n```php\ns('hello world')-\u003econtains('ello')\n=\u003e true\n```\n\nChainable: No\n\n#### endsWith()\n\nTest if the value ends with a given string.\n\n```php\ns('hello world')-\u003eendsWith('rld')\n=\u003e true\n```\n\nChainable: No\n\n#### length()\n\nReturn the length of a string.\n\n```php\ns('hello world')-\u003elength()\n=\u003e 11\n```\n\nChainable: No\n\n#### lowercase()\n\nMake a string lowercase.\n\n```php\ns('HeLlO WoRlD')-\u003elowercase()\n=\u003e \"hello world\"\n```\n\nChainable: Yes\n\n#### reverse()\n\nReverse a string.\n\n```php\ns('hello world')-\u003ereverse()\n=\u003e \"dlrow olleh\"\n```\n\nChainable: Yes\n\n#### startsWith()\n\nTest if the value starts with a given string.\n\n```php\ns('hello world')-\u003estartsWith('hel')\n=\u003e true\n```\n\nChainable: No\n\n#### uppercase()\n\nMake a string uppercase.\n\n```php\ns('HeLlO WoRlD')-\u003euppercase()\n=\u003e \"HELLO WORLD\"\n```\n\nChainable: Yes\n\n#### Chainable example:\n\n```php\n$string = s('hello world')-\u003ecapitalize()-\u003echop()-\u003ereverse();\n// $string = \"lroW olleH\"\n```\n\n### Arrays\n\nFor array methods you need to use the `value()` method to retrieve the value\nfrom chainable methods (e.g. `$array = s(['a'])-\u003eappend('b')-\u003evalue()`).\n\nComing soon...\n\n## Credits\n\nSclr was created by [Gilbert Pellegrom](http://gilbert.pellegrom.me) from [Dev7studios](http://dev7studios.com).\nReleased under the MIT license.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilbitron%2Fsclr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgilbitron%2Fsclr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgilbitron%2Fsclr/lists"}