PHPackages                             vector/core - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. vector/core

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

vector/core
===========

A functional programming library for PHP

v7.0.1(6y ago)19690[1 PRs](https://github.com/vector-php/vector/pulls)MITPHPPHP ^7.4CI passing

Since Jan 18Pushed 3mo ago2 watchersCompare

[ Source](https://github.com/vector-php/vector)[ Packagist](https://packagist.org/packages/vector/core)[ RSS](/packages/vector-core/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (1)Versions (56)Used By (0)

[![Vector Core](./logo.png)](./logo.png)[![Badge Status](https://camo.githubusercontent.com/c926fac3c7319cf194c5ce91329f51bd27a3dc0ee094e820de1dd3b92bd0c989/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f62616467652532307374617475732d64616e6b2d627269676874677265656e2e737667)](https://niceme.me/)

The Elevator Pitch
------------------

[](#the-elevator-pitch)

Vector gives you php functional superpowers.

- The evolution:

    - *Native PHP*```
          array_sum(
              array_map(
                  fn($a) => $a + 1,
                  [1, 2, 3]
              )
          );
          // 9
        ```

        - 👎 More than 1 or 2 function chains is unmaintainable
    - *Laravel Collections*```
          collect([1, 2, 3])
              ->map(fn($a) => $a + 1)
              ->sum();
              // 9
        ```

        - 👍 More than 1 or 2 function chains is unmaintainable
        - 👎 Unfortunately you can't do this with every type in the same elegant way (only works with collections)
    - *Vector*```
           vector([1, 2, 3])
               ->pipe(Arrays::map(Math::add(1))) // or `fn($a) => $a + 1)`
               ->pipe(Math::sum())();
               // [2, 3, 4]
        ```

        - 👍 Works super similarly to collections, but just accepts &amp; returns normal arrays (no -&gt;toArray()-ing necessary)
        - 👍 Works super similarly to collections for everything else too!
        - 👎 Unfortunately it is an extra dependency (we don't have the native pipe operator yet )
- You can add currying to any function, it isn't only limited to Vector built ins.

    - `Module::curry('explode')(',')('a,b,c')(PHP_INT_MAX)` `// ['a', 'b', 'c']`

PHP Version Support
-------------------

[](#php-version-support)

- 8.0+

Install
-------

[](#install)

```
composer require vector/core

```

Show Me Some More Code
----------------------

[](#show-me-some-more-code)

More automatic currying.

```
$addOne = Arrays::map(Math::add(1));
$addOne([1, 2, 3]); // [2, 3, 4]
```

First class composition (Functional Pipelines).

```
$addSix = Lambda::compose(Math::add(4), Math::add(2)); // (Or ::pipe for the opposite flow direction)
$addSix(4); // 10;
```

Pattern Matching (Maybe &amp; Result monads included).

```
Pattern::match([
    fn(Just $value) => fn ($unwrapped) => $unwrapped,
    fn(Nothing $value) => 'nothing',
])(Maybe::just('just')); // 'just'
```

Granular control flow (without try/catch).

```
$errorHandler = function (Err $err) {
    return Pattern::match([
        function (QueryException $exception) {
            Log::info($exception);
            return response(404);
        },
        function (DBException $exception) {
            Log::error($exception);
            return response(500);
        },
    ]);
};

return Pattern::match([
    fn(Ok $value) => fn (User $user) => $user,
    $errorHandler
])(Result::from(fn() => User::findOrFail(1)));
```

Make your own modules with auto-curried methods

```
use Vector\Core\Curry;
use Vector\Core\Module;

class MyModule
{
    use Module;

    #[Curry]
    protected static function myCurriedFunction($a, $b)
    {
        return $a + $b;
    }
}
```

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance57

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 81.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~30 days

Recently: every ~237 days

Total

51

Last Release

2251d ago

Major Versions

v2.0.27 → v3.0.02016-07-13

v3.0.10 → v4.0.02016-11-18

v4.0.0 → v5.0.02017-08-03

v5.1.0 → v6.0.02019-08-16

v6.0.0 → v7.0.02019-12-06

PHP version history (2 changes)v4.0.0PHP ^7.0

v7.0.0PHP ^7.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c147349739bf23edd28ef1587c7e4a8fefa3b8ed3d82392ad6e79125d0aac42?d=identicon)[loganhenson](/maintainers/loganhenson)

![](https://www.gravatar.com/avatar/a480c04085507592122fd4084f19d41eaa0f213d647f0e9f859a5abe0e72f5aa?d=identicon)[joseph-walker](/maintainers/joseph-walker)

---

Top Contributors

[![loganhenson](https://avatars.githubusercontent.com/u/2792946?v=4)](https://github.com/loganhenson "loganhenson (113 commits)")[![joseph-walker](https://avatars.githubusercontent.com/u/14129003?v=4)](https://github.com/joseph-walker "joseph-walker (26 commits)")

---

Tags

autoloadcurryingfunctionallibrarymemoizationphpvectorutilityfunctionalmonadcurrycompose

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vector-core/health.svg)

```
[![Health](https://phpackages.com/badges/vector-core/health.svg)](https://phpackages.com/packages/vector-core)
```

###  Alternatives

[nette/utils

🛠 Nette Utils: lightweight utilities for string &amp; array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.

2.1k394.3M1.5k](/packages/nette-utils)[ihor/nspl

Non-standard PHP library (NSPL) - functional primitives toolbox and more

381368.5k](/packages/ihor-nspl)[phpcsstandards/phpcsutils

A suite of utility functions for use with PHP\_CodeSniffer

6233.4M57](/packages/phpcsstandards-phpcsutils)[phamda/phamda

Auto-curried function library

1922.8k](/packages/phamda-phamda)[chippyash/monad

Functional programming Monad support

2828.1k8](/packages/chippyash-monad)[krak/fn

Functional library for php with proper currying

2419.0k3](/packages/krak-fn)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
