PHPackages                             rennokki/schedule - 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. [Database &amp; ORM](/categories/database)
4. /
5. rennokki/schedule

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

rennokki/schedule
=================

Schedule is a package that helps tracking schedules for your models. If you have workers in a company, you can set schedules for them and see their availability though the time.

1.6.0(7y ago)1551.4k↑1400%15[1 PRs](https://github.com/rennokki/schedule/pulls)MITPHP

Since May 27Pushed 6y ago6 watchersCompare

[ Source](https://github.com/rennokki/schedule)[ Packagist](https://packagist.org/packages/rennokki/schedule)[ Docs](https://github.com/rennokki/schedule)[ RSS](/packages/rennokki-schedule/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (14)Used By (0)

[![Build Status](https://camo.githubusercontent.com/ddfa6e4902a68962f52d831ad8fd069cad3690da9392a02c36e18a6921905e31/68747470733a2f2f7472617669732d63692e6f72672f72656e6e6f6b6b692f7363686564756c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/rennokki/schedule)[![codecov](https://camo.githubusercontent.com/eae25ff20bdcb7aa34fca39434200a09b0863ad5b5fe921624984a4888401f66/68747470733a2f2f636f6465636f762e696f2f67682f72656e6e6f6b6b692f7363686564756c652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/rennokki/schedule/branch/master)[![StyleCI](https://camo.githubusercontent.com/6361116d3bcdf12ac2cf62735b713466479678d94b0d5f5ebf79efc8c896ef70/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3133343336333130342f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/134363104)[![Latest Stable Version](https://camo.githubusercontent.com/4d4064a65f34354d4d0c26fd04491e9191f47247c21059c43c5a718e66443e61/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f7363686564756c652f762f737461626c65)](https://packagist.org/packages/rennokki/schedule)[![Total Downloads](https://camo.githubusercontent.com/5b88c929ca598d0a99e3f2d86e5db1f07a70c0a341cc82aec956320665b2bdaa/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f7363686564756c652f646f776e6c6f616473)](https://packagist.org/packages/rennokki/schedule)[![Monthly Downloads](https://camo.githubusercontent.com/4ef9229ca7743306350fe6e5c0fdd76cc43d10939b48cd945dfddc0ea49b7146/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f7363686564756c652f642f6d6f6e74686c79)](https://packagist.org/packages/rennokki/schedule)[![License](https://camo.githubusercontent.com/ac0498b70167614a36e772f5ac88340fbd591cdd7caa1098e97fc820d7902222/68747470733a2f2f706f7365722e707567782e6f72672f72656e6e6f6b6b692f7363686564756c652f6c6963656e7365)](https://packagist.org/packages/rennokki/schedule)

[![PayPal](https://camo.githubusercontent.com/e3d021da65162fda975bd58ef4a4d80bdd03d6e94aa1b321d179e6b4c1aff357/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f50617950616c2d646f6e6174652d626c75652e737667)](https://paypal.me/rennokki)

Schedule
========

[](#schedule)

Schedule is a package that helps tracking schedules for your models. If you have workers in a company, you can set schedules for them and see their availability though the time.

Inspiration
===========

[](#inspiration)

This package is inspired from [Spatie's Opening Hours](https://github.com/spatie/opening-hours) package, which uses a schedule but only statically, rather than binding it to a model. This gave me the idea of brining it closer to Eloquent Models than to the classic Class.

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

[](#installation)

Install the package via Composer CLI:

```
$ composer require rennokki/schedule
```

For versions of Laravel that doesn't support package discovery, you should add this to your `config/app.php` file, in the `providers` array:

```
\Rennokki\Schedule\ScheduleServiceProvider::class,
```

Publish the migration file and the config file.

```
$ php artisan vendor:publish
```

Migrate the database.

```
$ php artisan migrate
```

Add the trait to your model.

```
use Rennokki\Schedule\Traits\HasSchedule;

class User extends Model {
    use HasSchedule;
    ...
}
```

Getting Started
===============

[](#getting-started)

To get stared, let's create a schedule for our user. It will be from Monday to Friday, between 8-12 and 13-18.

```
$user->setSchedule([
    'monday' => ['08:00-12:00', '13:00-18:00'],
    'tuesday' => ['08:00-12:00', '13:00-18:00'],
    'wednesday' => ['08:00-12:00', '13:00-18:00'],
    'thursday' => ['08:00-12:00', '13:00-18:00'],
    'friday' => ['08:00-12:00', '13:00-18:00'],
]);

$user->hasSchedule(); // true
```

Let's say the user has its birthday on 1st March each year, so let's add this to an exclusions list. Adding to this, the first and the second day of Christmas is free for anyone, and let's add 1st May 2018 in our exclusions list too.

Note: 1st May 2018 will occur only once, it's not recurrent.

```
$user->setExclusions([
    '03-01' => ['08:00-12:00'],
    '12-25' => [],
    '12-26' => [],
    '2018-05-01' => [],
]);
```

Checking for availability
=========================

[](#checking-for-availability)

You can check if the user has working hours on a certain day, date. Passing date also works with Carbon instance.

```
$user->isAvailableOn('monday'); // true
$user->isAvailableOn('05-28'); // true; This is Monday, in 2018 (current year)
$user->isAvailableOn('2018-05-28'); // true
$user->isAvailableOn(Carbon::create(2018, 5, 28, 0, 0, 0)); // true

$user->isUnavailableOn('monday'); // false
$user->isUnavailableOn('05-28'); // false
$user->isUnavailableOn('2018-05-28'); // false
$user->isUnavailableOn(Carbon::create(2018, 5, 28, 0, 0, 0)); // false
```

If there is an exclusion that day, it will return the correct value based on the schedule set that day:

```
$user->isUnavailableOn('12-25'); // true
$user->isUnavailableOn('03-01'); // false
```

Checking for availability at a certain time
===========================================

[](#checking-for-availability-at-a-certain-time)

You can also check availability for a certain time on a specific day.

```
$user->isAvailableOnAt('monday', '09:00'); // true
$user->isUnavailableOnAt('monday', '09:00'); // false
```

Getting the amount of hours or minutes for a day
================================================

[](#getting-the-amount-of-hours-or-minutes-for-a-day)

You can get the amount of hours or minutes scheduled for a day. Good for tracking workable hours, for example.

```
$user->getHoursOn('03-01'); // 4
$user->getHoursOn('12-26'); // 0
$user->getHoursOn('05-28'); // 9
$user->getHoursOn('2018-05-28'); // 9

$user->getMinutesOn('03-01'); // 240
```

Deleting the schedule
=====================

[](#deleting-the-schedule)

If you plan to delete the user's schedule, you can do so by calling `deleteSchedule()`.

```
$user->deleteSchedule();
$user->hasSchedule(); // false
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity70

Established project with proven stability

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 ~25 days

Recently: every ~53 days

Total

12

Last Release

2629d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/21983456?v=4)[rennokki](/maintainers/rennokki)[@rennokki](https://github.com/rennokki)

---

Tags

eloquentlaravelmodelphpscheduletabletimetimetabletraitschedulerspatieschedulehoursopeningopening-hourstimetable

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/rennokki-schedule/health.svg)

```
[![Health](https://phpackages.com/badges/rennokki-schedule/health.svg)](https://phpackages.com/packages/rennokki-schedule)
```

###  Alternatives

[spatie/opening-hours

A helper to query and format a set of opening hours

1.7k5.3M30](/packages/spatie-opening-hours)[spatie/laravel-medialibrary

Associate files with Eloquent models

6.1k37.7M472](/packages/spatie-laravel-medialibrary)[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M189](/packages/spatie-laravel-backup)[spatie/laravel-tags

Add tags and taggable behaviour to your Laravel app

1.7k10.3M86](/packages/spatie-laravel-tags)[spatie/laravel-translatable

A trait to make an Eloquent model hold translations

2.4k23.0M412](/packages/spatie-laravel-translatable)[spatie/db-dumper

Dump databases

1.2k25.9M69](/packages/spatie-db-dumper)

PHPackages © 2026

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