PHPackages                             flysquare/laravel-recurring-models - 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. flysquare/laravel-recurring-models

ActiveLibrary

flysquare/laravel-recurring-models
==================================

Adds Repeatable functionlity to Laravel Models

v0.1.0(9mo ago)11MITPHPPHP ^8.1

Since Aug 11Pushed 9mo agoCompare

[ Source](https://github.com/FlySquare/laravel-recurring-models)[ Packagist](https://packagist.org/packages/flysquare/laravel-recurring-models)[ Docs](https://github.com/flysquare/laravel-recurring-models)[ RSS](/packages/flysquare-laravel-recurring-models/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (9)Versions (2)Used By (0)

Laravel Recurring Models
========================

[](#laravel-recurring-models)

[![Latest Version on Packagist](https://camo.githubusercontent.com/0d16134e6bc2d5d2dd0bd01044a7c4577b8e376bdd8ad0e5dc30865d5a8ca92b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6f68616d6d65646d616e73736f75722f6c61726176656c2d726563757272696e672d6d6f64656c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mohammedmanssour/laravel-recurring-models)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c5533abc32c35800d2214c0d39c685f80c9e33e1d552747d31f98fefca4e67bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f68616d6d65646d616e73736f75722f6c61726176656c2d726563757272696e672d6d6f64656c732f72756e2d74657374732e796d6c3f6272616e63683d6d6173746572266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mohammedmanssour/laravel-recurring-models/actions?query=workflow%3Arun-tests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/3d5778c755d04046b837541ca1634aa5adc3af71bbfd4ace60cb7bc14b6a0c30/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d6f68616d6d65646d616e73736f75722f6c61726176656c2d726563757272696e672d6d6f64656c732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d6173746572266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/mohammedmanssour/laravel-recurring-models/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/42c685e972be51c20fccffb2161434b68ad607e77714911c46044371eb6387bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6f68616d6d65646d616e73736f75722f6c61726176656c2d726563757272696e672d6d6f64656c732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mohammedmanssour/laravel-recurring-models)

Introducing our Laravel Recurring package - the ultimate solution for adding recurring functionality to your Laravel Models! Whether you need simple daily, weekly, or every n days recurrence, or more complex patterns like repeating a model on the second Friday of every month, our package has got you covered. With a seamless integration into your Laravel application, you can easily manage and automate recurring tasks with just a few lines of code.

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

[](#installation)

You can install the package via composer:

```
composer require flysquare/laravel-recurring-models
```

You can publish and run the migrations with:

```
php artisan vendor:publish --tag="recurring-models-migrations"
php artisan migrate
```

Usage
-----

[](#usage)

### Adding the recurring functionality to Models:

[](#adding-the-recurring-functionality-to-models)

1. Make sure you models implements `Repeatable` Contract.

```
use MohammedManssour\LaravelRecurringModels\Contracts\Repeatable as RepeatableContract;

class Task extends Model implements RepeatableContract
{

}
```

2. Add the `Repeatable` trait to your Model

```
use MohammedManssour\LaravelRecurringModels\Contracts\Repeatable as RepeatableContract;
use MohammedManssour\LaravelRecurringModels\Concerns\Repeatable;

class Task extends Model implements RepeatableContract
{
    use Repeatable;
}
```

3. Optionaly, customize Model base date.

```
/**
 * define the base date that we would use to calculate repetition start_at
 */
public function repetitionBaseDate(RepetitionType $type = null): Carbon
{
    return $this->created_at;
}
```

### Model Recurring rules

[](#model-recurring-rules)

The `Repeatable` trait has `repeat` method that will help you define the recurrence rules for the model.

The `repeat` method will return `Repeat` helper class that has 4 methods: `daily`, `everyNDays`, `weekly`, and `complex`

#### 1. Daily Recurrence

[](#1-daily-recurrence)

This will help you to create daily recurring rule for the model.

```
$model->repeat()->daily()
```

The recurrence will start the next day based on the `repetitionBaseDate` returned value.

#### 2. Every N Days Recurrence

[](#2-every-n-days-recurrence)

This will help you to create every N Days recurring rules for the model.

```
$model->repeat()->everyNDays(days: 3)
```

The recurrence will start after n=3 days based on the `repetitionBaseDate` returned value.

#### 3. Weekly Recurrence

[](#3-weekly-recurrence)

This will help ypi create weekly recurrence rule for the model.

```
$model->repeat()->weekly()
```

The recurrence will start after 7 days based on the `repetitionBaseDate` returned value.

You can specify the days of the recurrence using the `on` method.

```
$model->repeat()->weekly()->on(['sunday', 'monday', 'tuesday'])
```

#### 4. Complex Recurrence.

[](#4-complex-recurrence)

This will help you create complex recurrence rules for the task.

```
$model->repeat()
    ->complex(
        year: '*',
        month: '*',
        day: '*',
        week: '*',
        weekOfMonth: '*',
        weekday: '*'
    )
```

##### Examples

[](#examples)

1. Repeat model on the second friday of every month.

```
$model->repeat()->complex(weekOfMonth: 2, weekday: Carbon::FRIDAY)
```

2. Repeat model on the 15th day of every month.

```
$model->repeat()->complex(day: 15)
```

### Model Scopes

[](#model-scopes)

use `whereOccurresOn` scope to get models that occurres on a specific date.

```
Task::whereOccurresOn(Carbon::make('2023-05-01'))->get()

```

use `whereOccurresBetween` scope to get the models that occurres between two sepcific dates.

```
Task::whereOccurresBetween(Carbon::make('2023-05-01'), Carbon::make('2023-05-30'))->get()

```

#### 1. End Recurrance

[](#1-end-recurrance)

use `endsAt` to end occurrance on a specific date

```
$model->repeat()->daily()->endsAt(
    Carbon::make('2023-06-01')
)
```

use `endsAfter` to end occurrance after n times.

```
$model->repeat()->daily()->endsAfter($times);
```

#### 2. Start Recurrance

[](#2-start-recurrance)

use `startsAt` method to start occurrance after a specific date.

```
$model->repeat()->daily()->startsAt(
    Carbon::make()
)
```

Testing
-------

[](#testing)

```
composer test
```

Credits
-------

[](#credits)

- [Umut Can Arda](https://github.com/flysquare)
- [Mohammed Manssour](https://github.com/mohammedmanssour)

License
-------

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance62

Regular maintenance activity

Popularity3

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 70.8% 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

271d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/772e379f25da19fde41cae67b77bb94825201dc3b51f202113dcaf55d17df3e3?d=identicon)[flysquare](/maintainers/flysquare)

---

Top Contributors

[![mohammedmanssour](https://avatars.githubusercontent.com/u/19733629?v=4)](https://github.com/mohammedmanssour "mohammedmanssour (34 commits)")[![EriBloo](https://avatars.githubusercontent.com/u/19932449?v=4)](https://github.com/EriBloo "EriBloo (9 commits)")[![FlySquare](https://avatars.githubusercontent.com/u/47474804?v=4)](https://github.com/FlySquare "FlySquare (3 commits)")[![errand](https://avatars.githubusercontent.com/u/1334432?v=4)](https://github.com/errand "errand (1 commits)")[![justrau](https://avatars.githubusercontent.com/u/10882793?v=4)](https://github.com/justrau "justrau (1 commits)")

---

Tags

laravellaravel-recurring-modelsFlySquareumut can arda

###  Code Quality

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/flysquare-laravel-recurring-models/health.svg)

```
[![Health](https://phpackages.com/badges/flysquare-laravel-recurring-models/health.svg)](https://phpackages.com/packages/flysquare-laravel-recurring-models)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)

PHPackages © 2026

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