remeritus/livewire-rrule-generator

Generates RRule string using Livewire.

0.1.8 2024-02-01 20:32 UTC

README

Livewire RRule Generator

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Livewire Rrule Generator is a GUI for rlanvin/php-rrule. It generates RRULE from RFC 5545 complaint strings that can be used to manage recurring events.

Functionality is limited to Daily/Weekly/Monthly/Yearly rrules and GUI mimics Google Calendar approach.

Installation

You can install the package via composer:

composer require remeritus/livewire-rrule-generator

You can publish the config file with:

php artisan vendor:publish --tag="livewire-rrule-generator_without_prefix-config"

This is the content of the published config file:

return [
    'title'         => 'Define Schedule',
    'includeWeekend' => TRUE,
    'frequencies' => [
        'DAILY'     => TRUE,
        'WEEKLY'    => TRUE,
        'MONTHLY'   => TRUE,
        'YEARLY'    => TRUE,
    ],
    'defaultView'   => 'WEEKLY',
    'weekStarts'    => 'MO',
];

Setup

TailwindCSS

Add these additional lines into your tailwind.config.js file:

// use `purge` instead of `content` if using TailwindCSS v2.x
content: [
    './vendor/remeritus/livewire-rrule-generator/resources/views/**/*.blade.php',
    // etc...
]

Usage

In your views

If you want to create new Rrule string

<livewire:rrule-generator/>

If you want to edit existing Rrule string

If you want to edit existing RRule you can pass it to rrule-string

<livewire:rrule-generator rrule-string='FREQ=WEEKLY;COUNT=30;INTERVAL=1' />

Accessing RRule String

  • There is an <input type="hidden" ... name="rrule_string"/> from which you can extract the RRule String. So if you place <livewire:rrule-generator/> within a form it will be part of the forms data.
  • You can also listen to livewire event rruleCreated, which emits RRule String on Rrule's creation.

Credits

License

The MIT License (MIT). Please see License File for more information.