Download the PHP package moves/fowler-recurring-events without Composer

On this page you can find all versions of the php package moves/fowler-recurring-events. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fowler-recurring-events

FowlerRecurringEvents

Introduction

This library is an implementation of Martin Fowler's algorithms for recurring calendar events. See https://martinfowler.com/apsupp/recurring.pdf for more information.

This library is divided into several "Temporal Expression" classes, each of which can be used to determine whether an event occurs on a specific target date according to the specified pattern.

There are several different types of patterns included here which to the best of our knowledge are the most common amongst mainstream calendar providers such as Google Calendar.

Installation

To add this library into your project, run:

Available Patterns

Note that all patterns also include a frequency option which allows you to specify how often the pattern applies. For example, for the Days of Week pattern, you might want to specify recurrence every other weeks, rather than every week. In this case, you would set a frequency of 2 to specify that the pattern applies every 2 weeks.

Usage

To determine whether your repeating event occurs on a particular target date, first instantiate an instance of the appropriate Temporal Expression class with the details of your recurrence pattern, then call the includes() function.

Also note that all temporal expressions require a date on which the pattern begins.

For example, for an event which repeats every December 25th:

Frequency and Pattern End Date

The frequency and pattern end date properties are optional when constructing a temporal expression. To set values, for these optional properties, use the setter functions.

Builder Pattern

You can use the builder pattern with setter method chaining for more convenience when building your temporal expressions.

Practical Usage and Advice

The "Temporal Expression" algorithms are not intended to exist in a vacuum. In almost every instance, you will want to store a single "master" instance for the recurrence pattern, usually the first occurrence, along with the type of recurrence pattern or Temporal Expression and the required details of that particular pattern.

For developers who are inexperienced with calendar systems, it can be incredibly tempting to simply pre-calculate and store every possible instance of a repeating calendar event. However, doing so comes with massive inefficiencies as the runtime and data storage complexity for creating, editing, and deleting a series of events grows linearly the further out you intend to project. Plus, using this method, your projection has to stop somewhere, otherwise you would be stuck creating instances off into infinity, which in turn means that you must impose an end date to the pattern on your users.

Alternatively, you might think improve the data storage complexity and circumvent the "end date" limitation by storing a single "master" instance, and dynamically project that instance into the future. While this is the correct thought process, it is another place where inexperienced developers often run astray. The temptation is often to simply iterate over your pattern, day by day, week by week, month by month, or year by year, from the start date to the target projection date. With this method, of course, the runtime grows linearly the further out you intend to project, and thus it is not ideal for production calendar systems.

The Fowler methodology describes O(1) time algorithms for projecting calendar events, meaning that no matter how far out you intend to project, the runtime is always the same. If you intend to project out a list of calendar events that will occur during a specified period of time, such as rendering a month at a time in a Calendar GUI, you can query a list of "master" events, then iterate over each day you want to create a projection for, checking the Temporal expression for each master event on each day to dynamically build your list.

There are, of course, many many optimizations that you can apply to reduce the number of cases you have to check and calculate for when projecting a list of events for a specific period of time, but those are outside of the scope of this library.


All versions of fowler-recurring-events with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
nesbot/carbon Version ^2.53
ext-json Version *
illuminate/validation Version ^10.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package moves/fowler-recurring-events contains the following files

Loading the files please wait ....