PHPackages                             nikolajlovenhardt/laravel-edgerank - 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. nikolajlovenhardt/laravel-edgerank

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

nikolajlovenhardt/laravel-edgerank
==================================

Facebook Edgerank Algorithm for Laravel

0.0.1(1y ago)11MITPHPPHP &gt;=8.2

Since Mar 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nikolajlovenhardt/laravel-edgerank)[ Packagist](https://packagist.org/packages/nikolajlovenhardt/laravel-edgerank)[ Docs](https://github.com/nikolajlovenhardt/laravel-edgerank)[ RSS](/packages/nikolajlovenhardt-laravel-edgerank/feed)WikiDiscussions main Synced today

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

Laravel: Facebook EdgeRank Algorithm for Laravel
================================================

[](#laravel-facebook-edgerank-algorithm-for-laravel)

This package is a simple and flexible implementation of the Facebook EdgeRank algorithm for Laravel. Ideal for newsfeeds like Twitter, Facebook, LinkedIn, etc. Use the EdgeRank algorithm to sort posts and similar content based on factors such as likes, comments, shares, and time. The configuration makes it easy to manage the weighting of different parameters.

Installation and setup
----------------------

[](#installation-and-setup)

### Installation with Composer

[](#installation-with-composer)

```
composer require nikolajlovenhardt/laravel-edgerank

```

### Publish resources

[](#publish-resources)

Config

```
php artisan vendor:publish --tag="edgerank-config"

```

Migrations

```
php artisan vendor:publish --tag="edgerank-migrations"

```

Use-cases and demos
-------------------

[](#use-cases-and-demos)

### Sort posts using default weights

[](#sort-posts-using-default-weights)

```
use LaravelEdgeRank\Builders\EdgeRankBuilder;

$posts = EdgeRankBuilder::make()
    ->get();
```

### Limits and offsets

[](#limits-and-offsets)

#### Simple pagination

[](#simple-pagination)

Paginate with a simple limit and offset

```
use LaravelEdgeRank\Builders\EdgeRankBuilder;

$posts = EdgeRankBuilder::make()
    ->limit(50)
    ->offset(100)
    ->get();
```

#### Cursor

[](#cursor)

Do you need to paginate using ids? No worries, we got your back

```
use LaravelEdgeRank\Builders\EdgeRankBuilder;

$posts = EdgeRankBuilder::make()
    ->after(100, 'id') // Get older posts than #100
    ->get();
```

### Custom query

[](#custom-query)

Use the `$builder->query()` method to access the query builder before fetching the results. This allows you to add custom query code still utilizing the EdgeRank-sort.

```
use LaravelEdgeRank\Builders\EdgeRankBuilder;
use App\Models\Feed\Item;

$friendIds = [1, 2, 3, 4];

$posts = EdgeRankBuilder::make(Item::class)
    ->query()
    ->where(function ($query) use ($friendIds) {
        $query->whereIn('user_id', $friendIds)

        $query->orWhereHas('user', function () {
            $query->where('is_public', '=', true)
        });
    })
    ->get();
```

### Custom model / Override config

[](#custom-model--override-config)

Use a custom model without configuration using the `EdgeRankBuilder::make()` method, and add custom config using `weights()`and `options()`-methods.

```
use LaravelEdgeRank\Builders\EdgeRankBuilder;
use App\Models\Feed\Item;

$posts = EdgeRankBuilder::make(Item::class)
    ->weights([
        'likes' => 10,
        'hates' => 2,
        'customRelation' => 1.5, // Item->customRelation(): HasMany
    ])
    ->get();
```

Contributing
------------

[](#contributing)

Thank you for considering contributing to Laravel EdgeRank!

License
-------

[](#license)

Laravel EdgeRank is open-sourced software licensed under the [MIT license](LICENSE.md).

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance42

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Unknown

Total

1

Last Release

479d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3541622?v=4)[Nikolaj Løvenhardt](/maintainers/nikolajlovenhardt)[@nikolajlovenhardt](https://github.com/nikolajlovenhardt)

---

Top Contributors

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

---

Tags

laraveledgerank

### Embed Badge

![Health badge](/badges/nikolajlovenhardt-laravel-edgerank/health.svg)

```
[![Health](https://phpackages.com/badges/nikolajlovenhardt-laravel-edgerank/health.svg)](https://phpackages.com/packages/nikolajlovenhardt-laravel-edgerank)
```

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[firefly-iii/data-importer

Firefly III Data Import Tool.

8035.8k](/packages/firefly-iii-data-importer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k31](/packages/ronasit-laravel-helpers)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1320.9k4](/packages/team-nifty-gmbh-tall-datatables)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.4k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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