PHPackages                             outcloud/php-array-sum-callable - 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. outcloud/php-array-sum-callable

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

outcloud/php-array-sum-callable
===============================

Calculates sum of elements of array given by callback function

1.0.1(8y ago)016MITPHPPHP &gt;=7.0

Since Nov 13Pushed 8y ago1 watchersCompare

[ Source](https://github.com/OutCloud/php_array_sum_callable)[ Packagist](https://packagist.org/packages/outcloud/php-array-sum-callable)[ RSS](/packages/outcloud-php-array-sum-callable/feed)WikiDiscussions master Synced 6d ago

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

php\_array\_sum\_callable
=========================

[](#php_array_sum_callable)

Sums array of objects/numbets via callable function

Example usage:
==============

[](#example-usage)

Let's assume we have any object of any class with some numeric value inside. We have an array of that objects, and we have to calculate a sum of those numeric values.

Let's this be our class

```
class Num{
    private $value;

    public function __construct(int $number){
        $this->value = $number;
    }
    public function getValue(){
        return $this->value;
    }
}
```

we have array of items of 'Num' class

```
$items = [
    new Num(1),
    new Num(2),
    new Num(3),
];
```

Let's use array\_sum\_callable to calculate sum of that numbers

```
array_sum_callable($items, function($item){
    return $item->getValue();
});
```

Result will of course be: 6

#### Return Values

[](#return-values)

Returns the sum of values as an integer or float; 0 if the array is empty.

Installation
============

[](#installation)

via Composer:

```
composer require outcloud/php-array-sum-callable
```

function will be registered in global namespace.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

3106d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a71ff6ae76bede553308f22c471a029cf23536ab284f635ad2d6ec5d59da1750?d=identicon)[Macintoshx](/maintainers/Macintoshx)

---

Top Contributors

[![glieske](https://avatars.githubusercontent.com/u/7852170?v=4)](https://github.com/glieske "glieske (8 commits)")

### Embed Badge

![Health badge](/badges/outcloud-php-array-sum-callable/health.svg)

```
[![Health](https://phpackages.com/badges/outcloud-php-array-sum-callable/health.svg)](https://phpackages.com/packages/outcloud-php-array-sum-callable)
```

###  Alternatives

[joshribakoff/php-csv-utils

php-csv-utils

1143.8k1](/packages/joshribakoff-php-csv-utils)

PHPackages © 2026

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