PHPackages                             nuxia/business-day-manipulator - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. nuxia/business-day-manipulator

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

nuxia/business-day-manipulator
==============================

Business Day Manipulator

v0.1.0(11y ago)691.5k↓17.2%5[2 PRs](https://github.com/nuxia/BusinessDayManipulator/pulls)MITPHPPHP &gt;=5.4

Since Mar 13Pushed 3y ago5 watchersCompare

[ Source](https://github.com/nuxia/BusinessDayManipulator)[ Packagist](https://packagist.org/packages/nuxia/business-day-manipulator)[ RSS](/packages/nuxia-business-day-manipulator/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

[![Build Status](https://camo.githubusercontent.com/0c2784e5ab161826f73d3edecfdd5acb64beb1cbff414b060aa61f0aa4d928f4/68747470733a2f2f7472617669732d63692e6f72672f6e757869612f427573696e6573734461794d616e6970756c61746f722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/nuxia/BusinessDayManipulator)

Manipulate easily working days
==============================

[](#manipulate-easily-working-days)

- Find number of working days for a period.
- Find the ending date by adding the man day quantity to the starting date

Install
-------

[](#install)

- If you're using Composer to manage dependencies, you can use

```
composer require nuxia/business-day-manipulator
```

Simple Manipulator
------------------

[](#simple-manipulator)

```
use Nuxia\BusinessDayManipulator\Manipulator;

$holidays = [
    new DatePeriod(new \DateTime('2015-02-02'), new \DateTime('2015-02-06')),
    new \DateTime('2015-02-20')
];

$freeDays = [
    new DatePeriod(new \DateTime('2015-02-24'), new \DateTime('2015-02-27'))
];

$freeWeekDays = [
    Manipulator::SATURDAY,
    Manipulator::SUNDAY
];

$manipulator = new Manipulator($freeDays, $freeWeekDays, $holidays);
```

- **Free week days are repeated every week**
- **Holidays are repeated every year**
- **Free days are not repeated**

Localized Manipulator
---------------------

[](#localized-manipulator)

```
use Nuxia\BusinessDayManipulator\LocalizedManipulator;

$holidays = [
    new DatePeriod(new \DateTime('2015-02-02'), new \DateTime('2015-02-06')),
    new \DateTime('2015-02-20')
];

$freeDays = [
    new DatePeriod(new \DateTime('2015-02-24'), new \DateTime('2015-02-27'))
];

$freeWeekDays = null; //If null, we will automatically set free week days from the locale.

//Guess automatically free week days.
$localizedManipulator = new LocalizedManipulator('Europe/Paris', 'fr', $freeDays, $freeWeekDay, $holidays);
```

Working Day Date Predicator
---------------------------

[](#working-day-date-predicator)

```
$manipulator->setStartDate(new \DateTime('2015-02-01'));
$manipulator->addBusinessDays(15);
$manipulator->getDate()->format('Y-m-d'); //2015-03-06
```

```
$manipulator->setStartDate(new \DateTime('2015-03-06'));
$manipulator->subBusinessDays(15);
$manipulator->getDate()->format('Y-m-d'); //2015-02-01
```

Working Day Quantity Predicator
-------------------------------

[](#working-day-quantity-predicator)

```
$manipulator->setStartDate(new \DateTime('2015-02-01'));
$manipulator->setEndDate(new \DateTime('2015-03-02'));

$manipulator->getBusinessDays(); //12
$manipulator->getBusinessDaysDate()); //Array of DateTime instance
```

Manipulator::isBusinessDay()
----------------------------

[](#manipulatorisbusinessday)

```
$manipulator->isBusinessDay(new \DateTime('2015-02-08')); //false
```

Manipualtor::getTypeOfDay()
---------------------------

[](#manipualtorgettypeofday)

```
$manipulator->getTypeOfDay(new \DateTime('2015-02-08')); // free_week_day
```

Running test
------------

[](#running-test)

Simply run `phpunit` to execute unit test

License
-------

[](#license)

```
The MIT License (MIT)

Copyright (c) 2015 Nuxia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

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

Unknown

Total

1

Last Release

4084d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/008dc968ac3d1851c0b0ec4c89893773e42ecb49817fc5c1cb3cbe4d06800b46?d=identicon)[nuxia](/maintainers/nuxia)

---

Top Contributors

[![AlexDpy](https://avatars.githubusercontent.com/u/7074618?v=4)](https://github.com/AlexDpy "AlexDpy (4 commits)")[![royopa](https://avatars.githubusercontent.com/u/442991?v=4)](https://github.com/royopa "royopa (1 commits)")[![scalp](https://avatars.githubusercontent.com/u/1469157?v=4)](https://github.com/scalp "scalp (1 commits)")[![shengjie](https://avatars.githubusercontent.com/u/2143339?v=4)](https://github.com/shengjie "shengjie (1 commits)")[![shengjie-chez-agriconomie](https://avatars.githubusercontent.com/u/14922149?v=4)](https://github.com/shengjie-chez-agriconomie "shengjie-chez-agriconomie (1 commits)")

---

Tags

manipulatorWorking DayBusiness Day

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/nuxia-business-day-manipulator/health.svg)

```
[![Health](https://phpackages.com/badges/nuxia-business-day-manipulator/health.svg)](https://phpackages.com/packages/nuxia-business-day-manipulator)
```

###  Alternatives

[rovangju/carbon-nbd

Carbon DateTime extension to calculate the "next business day"

2125.4k](/packages/rovangju-carbon-nbd)

PHPackages © 2026

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