PHPackages                             codrasil/punchcard - 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. codrasil/punchcard

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

codrasil/punchcard
==================

A PHP Library for interacting with time records, time in, and time out.

v1.0.0(7y ago)26MITPHPPHP &gt;=7.1

Since Mar 16Pushed 7y ago1 watchersCompare

[ Source](https://github.com/codrasil/punchcard)[ Packagist](https://packagist.org/packages/codrasil/punchcard)[ RSS](/packages/codrasil-punchcard/feed)WikiDiscussions master Synced 4d ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

📇 Punchcard
===========

[](#card_index-punchcard)

A PHP Library for interacting with time records, time in, and time out.

[![Latest Stable Version](https://camo.githubusercontent.com/8cfb762d72a2f48ab11634e91627aba3caf615ed3982843a1ca0e0d37e940879/68747470733a2f2f706f7365722e707567782e6f72672f636f64726173696c2f70756e6368636172642f76657273696f6e)](https://packagist.org/packages/codrasil/punchcard)[![Total Downloads](https://camo.githubusercontent.com/6fdaaf05cf8231f8642d7ad95dbc3124741f08ff9fa209abf1061494d47234ae/68747470733a2f2f706f7365722e707567782e6f72672f636f64726173696c2f70756e6368636172642f646f776e6c6f616473)](https://packagist.org/packages/codrasil/punchcard)[![Latest Unstable Version](https://camo.githubusercontent.com/213777e36fa5da83829fd929800e2ef244c1119b72b8e403e30868deabd7533d/68747470733a2f2f706f7365722e707567782e6f72672f636f64726173696c2f70756e6368636172642f762f756e737461626c65)](//packagist.org/packages/codrasil/punchcard)[![License](https://camo.githubusercontent.com/5dbd4647d44fa1fa17e996187e8803d82cfda0a7716eec4baf228c17f750fdee/68747470733a2f2f706f7365722e707567782e6f72672f636f64726173696c2f70756e6368636172642f6c6963656e7365)](https://packagist.org/packages/codrasil/punchcard)

#### Requirements

[](#requirements)

- **php**: `>=7.1`
- **nesbot/carbon**: `^2.16`

#### Installation

[](#installation)

```
$ composer require codrasil/punchcard
```

```
{
    "require": {
        "codrasil/punchcard": "^1.*"
    }
}
```

#### Usage

[](#usage)

```
use Codrasil\Punchcard\Punchcard;

$punchcard = new Punchcard;

$punchcard->setTimeIn('8:00 AM') // parses into 08:00:00 format
          ->setTimeOut('5 PM');  // uses Carbon\Carbon for parsing strings to \DateTime

$punchcard->lunch($deductLunchHours = true); // calculate with lunch hours subtracted

echo $punchcard->totalDuration()->toString();
// performs: $timeOut - $timeIn = $duration in 00:00:00 format.
// outputs: 08:00:00

echo $punchcard->totalAM();
// outputs: 04:00:00

echo $punchcard->totalPM();
// outputs: 04:00:00

$punchcard->lunch(false);
echo $punchcard->totalDuration()->toString();
// outputs: 09:00:00

// Other methods:
$punchcard->setTimeIn('8:15 AM');
$punchcard->totalTardy()->toString();
$punchcard->totalTardyAM()->toString(); // this is the same with totalTardy
// outputs: 00:15:00

// Assuming afternoon work resumes at 1PM:
$punchcard->setTimeIn('1:15 PM');
$punchcard->totalTardyPM()->toString();
// outputs: 00:15:00

// Assuming work ends at 5PM
$punchcard->setTimeOut('6:20 PM');
$punchcard->totalOvertime()->toString();
// outputs: 01:20:00

// Assuming work ends at 5PM
$punchcard->setTimeOut('4:20 PM');
$punchcard->totalUndertime()->toString();
// outputs: 5:00PM - 4:20PM = 00:40:00

// AM undertime calculate against default_lunch_start
$punchcard->totalUndertimeAM()->toString();
$punchcard->totalUndertimePM()->toString(); // this is the same with totalUndertime
```

#### Options

[](#options)

You may pass options upon initialization:

```
$options = [
    'default_time_in' => '09:00:00', // default is 08:00:00
    'default_time_out' => '18:00:00', // default is 17:00:00
    'default_lunch_start' => '12:00:00', // default 12:00:00
    'default_lunch_end' => '13:00:00', // default 13:00:00
];

$punchcard = new Punchcard($options);
```

Or via method `setParams`:

```
$punchcard->setParams($options);
```

#### Documentation

[](#documentation)

coming soon

#### License

[](#license)

The Codrasil/Punchcard PHP library is open-source software licensed under the [MIT license](./LICENSE).

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

2665d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15792724?v=4)[John Lioneil Dionisio](/maintainers/lioneil)[@lioneil](https://github.com/lioneil)

---

Top Contributors

[![lioneil](https://avatars.githubusercontent.com/u/15792724?v=4)](https://github.com/lioneil "lioneil (18 commits)")

---

Tags

dtrpunchcardtimetimeintimeouttimesheetphpTime Managementdtrtimesheet

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/codrasil-punchcard/health.svg)

```
[![Health](https://phpackages.com/badges/codrasil-punchcard/health.svg)](https://phpackages.com/packages/codrasil-punchcard)
```

###  Alternatives

[illuminate/support

The Illuminate Support package.

630113.0M40.8k](/packages/illuminate-support)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k17](/packages/solspace-craft-freeform)[limingxinleo/hyperf-utils

Utils for Hyperf.

29137.1k3](/packages/limingxinleo-hyperf-utils)[bitrix24/b24phpsdk

An official PHP library for the Bitrix24 REST API

10244.2k5](/packages/bitrix24-b24phpsdk)[hyperf/crontab

A crontab component for Hyperf.

131.7M73](/packages/hyperf-crontab)[japanese-date/japanese-date

日本の暦、祝日を取り扱うライブラリ

1710.0k](/packages/japanese-date-japanese-date)

PHPackages © 2026

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