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 1mo ago

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

25

—

LowBetter than 37% of packages

Maintenance45

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

426d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2dbf4fb3573f60b0979c7959c29de2d534d0c954f43e55bbcf95d60641780004?d=identicon)[nikolajlovenhardt](/maintainers/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

[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[gehrisandro/tailwind-merge-laravel

TailwindMerge for Laravel merges multiple Tailwind CSS classes by automatically resolving conflicts between them

341682.2k18](/packages/gehrisandro-tailwind-merge-laravel)[nickurt/laravel-akismet

Akismet for Laravel 11.x/12.x/13.x

97139.6k2](/packages/nickurt-laravel-akismet)[whitecube/laravel-timezones

Store UTC dates in the database and work with custom timezones in the application.

106106.2k](/packages/whitecube-laravel-timezones)[sbine/route-viewer

A Laravel Nova tool to view your registered routes.

57215.9k](/packages/sbine-route-viewer)[forxer/laravel-gravatar

A library providing easy gravatar integration in a Laravel project.

4235.6k](/packages/forxer-laravel-gravatar)

PHPackages © 2026

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