{"id":37266079,"url":"https://github.com/vector-php/vector","last_synced_at":"2026-01-16T00:32:27.529Z","repository":{"id":56060062,"uuid":"49901392","full_name":"vector-php/vector","owner":"vector-php","description":"A PHP functional programming library.","archived":false,"fork":false,"pushed_at":"2020-11-27T21:15:56.000Z","size":1183,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-13T10:59:27.030Z","etag":null,"topics":["autoload","currying","functional","library","memoization","php","vector"],"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/vector-php.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-18T19:56:10.000Z","updated_at":"2024-11-11T18:07:22.000Z","dependencies_parsed_at":"2022-08-15T12:20:54.063Z","dependency_job_id":null,"html_url":"https://github.com/vector-php/vector","commit_stats":null,"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"purl":"pkg:github/vector-php/vector","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vector-php%2Fvector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vector-php%2Fvector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vector-php%2Fvector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vector-php%2Fvector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vector-php","download_url":"https://codeload.github.com/vector-php/vector/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vector-php%2Fvector/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28421216,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:47:48.104Z","status":"ssl_error","status_checked_at":"2026-01-14T10:46:19.031Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["autoload","currying","functional","library","memoization","php","vector"],"created_at":"2026-01-16T00:32:26.844Z","updated_at":"2026-01-16T00:32:27.520Z","avatar_url":"https://github.com/vector-php.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Vector Core](./logo.png)\n[![Badge Status](https://img.shields.io/badge/badge%20status-dank-brightgreen.svg)](https://niceme.me/)\n\n## The Elevator Pitch\nVector gives you php functional superpowers.\n- The evolution:\n    - _Native PHP_\n        ```php\n          array_sum(\n              array_map(\n                  fn($a) =\u003e $a + 1,\n                  [1, 2, 3]\n              )\n          );\n          // 9\n        ```\n        - 👎 More than 1 or 2 function chains is unmaintainable\n    - _Laravel Collections_\n        ```php\n          collect([1, 2, 3])\n              -\u003emap(fn($a) =\u003e $a + 1)\n              -\u003esum();\n              // 9\n        ```\n        - 👍 More than 1 or 2 function chains is unmaintainable\n        - 👎 Unfortunately you can't do this with every type in the same elegant way (only works with collections)\n    -  _Vector_\n        ```php\n           vector([1, 2, 3])\n               -\u003epipe(Arrays::map(Math::add(1))) // or `fn($a) =\u003e $a + 1)` \n               -\u003epipe(Math::sum())();\n               // [2, 3, 4]\n        ```\n        - 👍 Works super similarly to collections, but just accepts \u0026 returns normal arrays (no -\u003etoArray()-ing necessary) \n        - 👍 Works super similarly to collections for everything else too!\n        - 👎 Unfortunately it is an extra dependency (we don't have the native pipe operator yet https://wiki.php.net/rfc/pipe-operator-v2)\n\n- You can add currying to any function, it isn't only limited to Vector built ins.\n    - `Module::curry('explode')(',')('a,b,c')(PHP_INT_MAX)` `// ['a', 'b', 'c']`\n\n## PHP Version Support\n- 8.0+\n\n## Install\n```\ncomposer require vector/core\n```\n\n## Show Me Some More Code\n\nMore automatic currying.\n```php\n$addOne = Arrays::map(Math::add(1));\n$addOne([1, 2, 3]); // [2, 3, 4]\n```\n\nFirst class composition (Functional Pipelines).\n```php\n$addSix = Lambda::compose(Math::add(4), Math::add(2)); // (Or ::pipe for the opposite flow direction)\n$addSix(4); // 10;\n```\n\nPattern Matching (Maybe \u0026 Result monads included).\n```php\nPattern::match([\n    fn(Just $value) =\u003e fn ($unwrapped) =\u003e $unwrapped,\n    fn(Nothing $value) =\u003e 'nothing',\n])(Maybe::just('just')); // 'just'\n```\n\nGranular control flow (without try/catch).\n```php\n$errorHandler = function (Err $err) {\n    return Pattern::match([\n        function (QueryException $exception) {\n            Log::info($exception);\n            return response(404);\n        },\n        function (DBException $exception) {\n            Log::error($exception);\n            return response(500);\n        },\n    ]);\n};\n\nreturn Pattern::match([\n    fn(Ok $value) =\u003e fn (User $user) =\u003e $user,\n    $errorHandler\n])(Result::from(fn() =\u003e User::findOrFail(1)));\n```\n\nMake your own modules with auto-curried methods\n```php\nuse Vector\\Core\\Curry;\nuse Vector\\Core\\Module;\n\nclass MyModule\n{\n    use Module;\n    \n    #[Curry]\n    protected static function myCurriedFunction($a, $b)\n    {\n        return $a + $b;\n    }\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvector-php%2Fvector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvector-php%2Fvector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvector-php%2Fvector/lists"}