PHPackages                             foxws/laravel-algos - 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. foxws/laravel-algos

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

foxws/laravel-algos
===================

Create algos for your Laravel application

0.3.0(2mo ago)22.7kMITPHPPHP ^8.2CI passing

Since Oct 30Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/foxws/laravel-algos)[ Packagist](https://packagist.org/packages/foxws/laravel-algos)[ Docs](https://github.com/foxws/laravel-algos)[ GitHub Sponsors](https://github.com/Foxws)[ RSS](/packages/foxws-laravel-algos/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (32)Versions (11)Used By (0)

Laravel Algos
=============

[](#laravel-algos)

[![Latest Version on Packagist](https://camo.githubusercontent.com/18bed945757622469187cc38b1a9b9b99a23f928583de84e36a0bfa29a3fb138/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f7877732f6c61726176656c2d616c676f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/foxws/laravel-algos)[![GitHub Tests Action Status](https://camo.githubusercontent.com/5c14104ec681ca84d99b1b619e765e41655da6de1656803fdc7140f7511afc55/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f666f7877732f6c61726176656c2d616c676f732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/foxws/laravel-algos/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/e7b1d04127fd3f26b8ef44c943cce37787a985f720ee607de563a0ac78667478/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f666f7877732f6c61726176656c2d616c676f732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/foxws/laravel-algos/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/76459cdfbe9b042b0fdf85a92e0e3d513a9be4a908ef37c9e3ef14ae540e54a4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666f7877732f6c61726176656c2d616c676f732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/foxws/laravel-algos)

This package can be used to create algorithms (algos) for your Laravel application.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require foxws/laravel-algos
```

Usage
-----

[](#usage)

Generate an `Algo` class (you may also use `php artisan make:algo MyAlgo`):

```
use Foxws\Algos\Algos\Algo;
use Foxws\Algos\Algos\Result;
use Foxws\Algos\Tests\Models\Post;
use Foxws\Algos\Tests\Models\User;
use Illuminate\Support\Collection;
use Illuminate\Support\Str;

class GenerateUserFeed extends Algo
{
    protected ?User $user = null;

    public function handle(): Result
    {
        $hash = $this->generateUniqueId();

        cache()->set(
            $this->generateUniqueId(),
            ['ids' => (array) $this->getCollection()],
            now()->addMinutes(10),
        );

        return $this
            ->success('Feed generated successfully')
            ->with('hash', $hash);
    }

    public function model(User $user): self
    {
        $this->user = $user;

        return $this;
    }

    protected function getCollection(): Collection
    {
        return Post::query()
            ->select('id')
            ->where('user_id', $this->user->getKey())
            ->inRandomOrder()
            ->take(5)
            ->get();
    }

    protected function generateUniqueId(): string
    {
        return Str::ulid();
    }
}
```

To run the algorithm:

```
$algo = GenerateUserFeed::make()->model($user)->run();

// $algo->status; // success, failed, skipped
// $algo->message; // reason
// $algo->meta; // array of metadata
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [francoism90](https://github.com/foxws)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance89

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 68.2% 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 ~84 days

Recently: every ~125 days

Total

7

Last Release

62d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5028905?v=4)[François M.](/maintainers/francoism90)[@francoism90](https://github.com/francoism90)

---

Top Contributors

[![francoism90](https://avatars.githubusercontent.com/u/5028905?v=4)](https://github.com/francoism90 "francoism90 (30 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (5 commits)")

---

Tags

actionsalgorithmsalgosfoxwslaravellaravelalgorithmslaravel-algosalgosalgo

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/foxws-laravel-algos/health.svg)

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

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[spatie/laravel-livewire-wizard

Build wizards using Livewire

4061.0M4](/packages/spatie-laravel-livewire-wizard)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

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