Skip to content

Commit

Permalink
added README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ludovicm67 committed Mar 29, 2019
1 parent fe97a20 commit aacde57
Showing 1 changed file with 83 additions and 0 deletions.
83 changes: 83 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
Superdate
=========

> Some useful functions for working with dates
[![Latest Stable Version](https://poser.pugx.org/ludovicm67/superdate/v/stable)](https://packagist.org/packages/ludovicm67/superdate)
[![Total Downloads](https://poser.pugx.org/ludovicm67/superdate/downloads)](https://packagist.org/packages/ludovicm67/superdate)
[![Build Status](https://travis-ci.org/ludovicm67/php-superdate.svg?branch=master)](https://travis-ci.org/ludovicm67/php-superdate)
[![Coverage Status](https://coveralls.io/repos/github/ludovicm67/php-superdate/badge.svg?branch=master)](https://coveralls.io/github/ludovicm67/php-superdate?branch=master)
[![License](https://poser.pugx.org/ludovicm67/superdate/license)](https://packagist.org/packages/ludovicm67/superdate)

## Installation

Just run the following command: `composer require ludovicm67/superdate`
to add it to your PHP project!

## Getting started

If you installed using composer, you can now create a file with the following code:

```php
<?php

// import here the composer autoloader
require('./vendor/autoload.php');

// use the namespace for this library
use ludovicm67\SuperDate\Date;

// your code below...
```

### create a Date object

Many ways to initialize the object.

For example:

```php
// value: today
$date = new Date();
$date = new Date(null);

// value: specified date
$date = new Date("2019-03-21");
```

### all days to an other date

Get an array of all days from the current date to an other one.

Example:

```php
$date = new Date("2019-03-21");
$allDaysTo = $date->allDaysTo("2019-04-03");

// $allDaysTo will be an array containing all 14 days
// between 2019-03-21 and 2019-04-03 included
```

### is a week day or a weekend day?

```php
$date->isWeekDay(); // true if between monday and friday, false if saturday or sunday
$date->isWeekEnd(); // false if between monday and friday, true if saturday or sunday
```

### is it a holiday day?

Based on Alsace, France holidays.

Usage:

```php
$date->isHoliday(); // true if holiday, false if not
```

## Want to contribute?

Feel free to fork, commit and open a pull-request.

Or just open an issue here: https://github.com/ludovicm67/php-superdate/issues.

0 comments on commit aacde57

Please sign in to comment.