{"id":13669502,"url":"https://github.com/ilya-dev/belt","last_synced_at":"2025-04-27T04:33:16.632Z","repository":{"id":15862870,"uuid":"18603356","full_name":"ilya-dev/belt","owner":"ilya-dev","description":"A handful of tools for PHP developers.","archived":false,"fork":false,"pushed_at":"2014-06-15T16:42:31.000Z","size":986,"stargazers_count":717,"open_issues_count":2,"forks_count":55,"subscribers_count":41,"default_branch":"master","last_synced_at":"2024-11-06T14:19:13.130Z","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/ilya-dev.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}},"created_at":"2014-04-09T15:54:47.000Z","updated_at":"2024-08-12T19:13:38.000Z","dependencies_parsed_at":"2022-09-07T15:50:53.340Z","dependency_job_id":null,"html_url":"https://github.com/ilya-dev/belt","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilya-dev%2Fbelt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilya-dev%2Fbelt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilya-dev%2Fbelt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ilya-dev%2Fbelt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ilya-dev","download_url":"https://codeload.github.com/ilya-dev/belt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224060341,"owners_count":17249002,"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":"2024-08-02T08:01:15.751Z","updated_at":"2024-11-11T06:30:26.920Z","avatar_url":"https://github.com/ilya-dev.png","language":"PHP","funding_links":[],"categories":["PHP","目录","类库"],"sub_categories":["数字 Numbers","未归类"],"readme":"# Belt\n\n[![Build Status](https://travis-ci.org/ilya-dev/belt.svg?branch=master)](https://travis-ci.org/ilya-dev/belt)\n\nA handful of tools for PHP developers.\n\n\n\u003e Version **2.0.0** is out now. Clear documentation, improved tests and code quality.\n\n## Installation\n\nIn case you want to try it out, run:\n\n\n`php composer.phar require \"ilya/belt:~2\"`\n\nThat will add Belt to your project as a Composer dependency.\n\n## Example\n\nA little taste of Belt:\n\n```php\n\nuse Belt\\Belt;\n\nBelt::max([1, 2, 3]) // =\u003e 3\n\nBelt::flatten([1, [2, [3]]]) // =\u003e [1, 2, 3]\n\nBelt::last([1, 2, 3], 2) // =\u003e [2, 3]\n\n```\n\n## What It Offers\n\n+ **60+** useful functions that you can use in your projects.\n+ Belt is fully tested.\n+ The source code is clean and documented.\n\nHere is what is available to you:\n\n+ `boolean isDate(mixed $value)`\n+ `boolean isNumber(mixed $value)`\n+ `boolean isString(mixed $value)`\n+ `boolean isFunction(mixed $value)`\n+ `boolean isEmpty(mixed $value)`\n+ `boolean isEqual(mixed $left, mixed $right)`\n+ `boolean isBoolean(mixed $value)`\n+ `boolean isObject(mixed $value)`\n+ `boolean isArray(mixed $value)`\n+ `boolean isTraversable(mixed $value)`\n+ `boolean isNull(mixed $value)`\n+ `boolean has(mixed $object, string $key)`\n+ `array keys(mixed $object)`\n+ `array values(mixed $object)`\n+ `array methods(mixed $object)`\n+ `mixed copy(mixed $value)`\n+ `mixed extend(mixed $source, mixed $destination)`\n+ `mixed apply(mixed $object, Closure $closure)`\n+ `mixed defaults(mixed $object, array|mixed $defaults)`\n+ `string escape(string $string)`\n+ `string id(string $prefix = '')`\n+ `mixed with(mixed $value)`\n+ `void times(integer $number, Closure $closure)`\n+ `mixed cache(Closure $closure)`\n+ `mixed wrap(Closure $closure, Closure $wrapper)`\n+ `mixed compose(array $closures, array $arguments = array())`\n+ `void once(Closure $closure)`\n+ `mixed after(integer $number, Closure $closure)`\n+ `mixed|array first(array $elements, integer $amount = 1)`\n+ `array initial(array $elements, integer $amount = 1)`\n+ `array rest(array $elements, integer $index = 1)`\n+ `mixed|array last(array $elements, integer $amount = 1)`\n+ `array pack(array $elements)`\n+ `array flatten(array $elements)`\n+ `array range(integer $to, integer $from = 0, integer $step = 1)`\n+ `array difference(array $one, array $another)`\n+ `array unique(array $elements, Closure $iterator = null)`\n+ `array without(array $elements, array $ignore)`\n+ `array zip(array $one, array $another)`\n+ `integer indexOf(array $elements, mixed $element)`\n+ `array intersection(array $one, array $another)`\n+ `array union(array $one, array $another)`\n+ `void each(array $collection, Closure $iterator)`\n+ `array map(array $collection, Closure $iterator)`\n+ `array toArray(mixed $value)`\n+ `integer|null size(array|Countable $value)`\n+ `array shuffle(array $collection)`\n+ `boolean any(array $collection, Closure $iterator)`\n+ `boolean all(array $collection, Closure $iterator)`\n+ `array reject(array $collection, Closure $iterator)`\n+ `array pluck(array $collection, string $key)`\n+ `boolean contains(array $collection, mixed $value)`\n+ `array invoke(array $collection, string $function)`\n+ `mixed reduce(array $collection, Closure $iterator, mixed $initial = 0)`\n+ `array sortBy(array $collection, Closure $iterator)`\n+ `array groupBy(array $collection, Closure $iterator)`\n+ `mixed max(array $collection)`\n+ `mixed min(array $collection)`\n\n## Development\n\n### Plans\n\n+ Add `PHP 5.6` support - leverage **variadic functions**.\n\n### Features\n\n+ **Collections** [done]\n  + each [done]\n  + map [done]\n  + reduce [done]\n  + max [done]\n  + min [done]\n  + size [node]\n  + toArray [done]\n  + groupBy [done]\n  + sortBy [done]\n  + shuffle [done]\n  + all [done]\n  + any [done]\n  + pluck [done]\n  + contains [done]\n  + invoke [done]\n  + reject [done]\n+ **Arrays** [done]\n  + first [done]\n  + initial [done]\n  + rest [done]\n  + last [done]\n  + pack [done]\n  + flatten [done]\n  + without [done]\n  + unique [done]\n  + union [done]\n  + difference [done]\n  + zip [done]\n  + intersection [done]\n  + range [done]\n  + indexOf [done]\n+ **Functions** [done]\n  + cache [done] \n  + once [done]\n  + wrap [done]\n  + after [done]\n  + compose [done]\n+ **Objects** [done]\n  + keys [done]\n  + values [done]\n  + copy [done]\n  + extend [done]\n  + defaults [done]\n  + methods [done]\n  + apply [done]\n  + has [done]\n  + isEqual [done]\n  + isEmpty [done]\n  + isObject [done]\n  + isArray [done]\n  + isTraversable [done]\n  + isFunction [done]\n  + isString [done]\n  + isNumber [done]\n  + isBoolean [done]\n  + isDate [done]\n  + isNull [done]\n+ **Utilities** [done]\n  + with [done] \n  + times [done]\n  + id [done]\n  + escape [done]\n\n## License\n\nBelt is licensed under the MIT license.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filya-dev%2Fbelt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Filya-dev%2Fbelt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Filya-dev%2Fbelt/lists"}