Download the PHP package oranfry/periods without Composer

On this page you can find all versions of the php package oranfry/periods. 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 periods

Periods

A framework for chunking the calendar

Introduction

A Period is a system of chunking all dates on the calendar. Month and Week are examples of periods, because they are ways to chunk the calendar with no overlaps and no gaps in between.

The purpose of this framework is to allow one to implement and work easily with periods, including custom-designed ones.

Examples of custom periods could be:

As you can guess from the last few examples, there doesn't need to be any mathematical uniformity or predictability to the periods. Periods are implemented as PHP functions, so the chunks can be determined in as mathmatical or as piecemeal a fashion as desired.

Terminology

All dates means all possible, valid dates. 'Valid dates' according to this framework means all dates accepted by PHP's strtotime() function in the format 'YYYY-MM-DD' (e.g., '2023-08-01'), that are also valid according to PHP's checkdate(). There are about 3.65M valid dates.

This means dates back further than '0000-00-00' or forward further than '9999-12-31' are not accepted, and the implementor does not need to identify what chunk they fall into.

The term Period refers to a system of chunking (such as "Week").

The term chunk to refer to a particular chunk under such a system (such as "Week 47 of 2024").

How to Implement

To implement a custom Period (a.k.a., a custom system), you only need to be able to produce the start and end dates of the chunk which contains any given date.

For example, suppose you wish to implement the Period "Weeks starting on Tuesday". You would implement the following methods which take an arbitrary valid date, and compute and return as specified:

Note that start and end dates are inclusive, so if a period starts and ends on the same day, it is 1 day in length.

Some constraints:

The framework does not attempt to verify that your implementation is conforming to these constraints, so the disclaimer is made that you will get undefined behaviour id you do not adhere to these constraints. Please put some unit tests in place to validate any Periods you implement. In the future I will add a testing framework for periods under development.

The framework takes care of making sure only valid dates are passed to your _start() and _end() methods.

Optional Implementation

Optionally, you can also implement chunk IDs and labels by implementing the method _chunkId($from, $to), _chunkLabel($from, $to). Here are some example labels based on the same week under different Period systems:

The corresponding options for IDs might be something like these:

If you are using multiple period systems in one application and want to make sure the chunk IDs don't conflict with each other, prepend them with something unique to the period before saving:

How to use

Please see the examples below.

Examples

For an example of how to use periods, please see example/*.


All versions of periods with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
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 oranfry/periods contains the following files

Loading the files please wait ....