{"id":29017839,"url":"https://github.com/cakephp/utility","last_synced_at":"2025-06-25T23:07:08.347Z","repository":{"id":20505415,"uuid":"23783967","full_name":"cakephp/utility","owner":"cakephp","description":"[READ-ONLY] CakePHP Utility classes such as Inflector, Text, Hash, Security and Xml. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp","archived":false,"fork":false,"pushed_at":"2025-06-21T03:38:37.000Z","size":17415,"stargazers_count":120,"open_issues_count":0,"forks_count":10,"subscribers_count":32,"default_branch":"master","last_synced_at":"2025-06-21T04:29:19.087Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cakephp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"Security.php","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-09-08T08:32:23.000Z","updated_at":"2025-05-19T08:15:29.000Z","dependencies_parsed_at":"2024-01-07T05:11:32.963Z","dependency_job_id":"8822a74a-3594-4c79-810f-c37bf41a214f","html_url":"https://github.com/cakephp/utility","commit_stats":{"total_commits":581,"total_committers":76,"mean_commits":7.644736842105263,"dds":0.7641996557659209,"last_synced_commit":"4259ae4154e639557af751ae719d58253a79282a"},"previous_names":[],"tags_count":308,"template":false,"template_full_name":null,"purl":"pkg:github/cakephp/utility","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Futility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Futility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Futility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Futility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cakephp","download_url":"https://codeload.github.com/cakephp/utility/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Futility/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261967132,"owners_count":23237663,"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":[],"created_at":"2025-06-25T23:07:07.115Z","updated_at":"2025-06-25T23:07:08.325Z","avatar_url":"https://github.com/cakephp.png","language":"PHP","readme":"[![Total Downloads](https://img.shields.io/packagist/dt/cakephp/utility.svg?style=flat-square)](https://packagist.org/packages/cakephp/utility)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE.txt)\n\n# CakePHP Utility Classes\n\nThis library provides a range of utility classes that are used throughout the CakePHP framework\n\n## What's in the toolbox?\n\n### Hash\n\nA ``Hash`` (as in PHP arrays) class, capable of extracting data using an intuitive DSL:\n\n```php\n$things = [\n    ['name' =\u003e 'Mark', 'age' =\u003e 15],\n    ['name' =\u003e 'Susan', 'age' =\u003e 30],\n    ['name' =\u003e 'Lucy', 'age' =\u003e 25]\n];\n\n$bigPeople = Hash::extract($things, '{n}[age\u003e21].name');\n\n// $bigPeople will contain ['Susan', 'Lucy']\n```\n\nCheck the [official Hash class documentation](https://book.cakephp.org/4/en/core-libraries/hash.html)\n\n### Inflector\n\nThe Inflector class takes a string and can manipulate it to handle word variations\nsuch as pluralizations or camelizing.\n\n```php\necho Inflector::pluralize('Apple'); // echoes Apples\n\necho Inflector::singularize('People'); // echoes Person\n```\n\nCheck the [official Inflector class documentation](https://book.cakephp.org/4/en/core-libraries/inflector.html)\n\n### Text\n\nThe Text class includes convenience methods for creating and manipulating strings.\n\n```php\nText::insert(\n    'My name is :name and I am :age years old.',\n    ['name' =\u003e 'Bob', 'age' =\u003e '65']\n);\n// Returns: \"My name is Bob and I am 65 years old.\"\n\n$text = 'This is the song that never ends.';\n$result = Text::wrap($text, 22);\n\n// Returns\nThis is the song\nthat never ends.\n```\n\nCheck the [official Text class documentation](https://book.cakephp.org/4/en/core-libraries/text.html)\n\n### Security\n\nThe security library handles basic security measures such as providing methods for hashing and encrypting data.\n\n```php\n$key = 'wt1U5MACWJFTXGenFoZoiLwQGrLgdbHA';\n$result = Security::encrypt($value, $key);\n\nSecurity::decrypt($result, $key);\n```\n\nCheck the [official Security class documentation](https://book.cakephp.org/4/en/core-libraries/security.html)\n\n### Xml\n\nThe Xml class allows you to easily transform arrays into SimpleXMLElement or DOMDocument objects\nand back into arrays again\n\n```php\n$data = [\n    'post' =\u003e [\n        'id' =\u003e 1,\n        'title' =\u003e 'Best post',\n        'body' =\u003e ' ... '\n    ]\n];\n$xml = Xml::build($data);\n```\n\nCheck the [official Xml class documentation](https://book.cakephp.org/4/en/core-libraries/xml.html)\n","funding_links":[],"categories":["杂项 Miscellaneous","Configuration"],"sub_categories":["Miscellaneous"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcakephp%2Futility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcakephp%2Futility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcakephp%2Futility/lists"}