PHPackages                             ryanwinchester/carbonize - 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. ryanwinchester/carbonize

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

ryanwinchester/carbonize
========================

Carbon helper for cloning and creating new Carbon instances.

v0.2.0(8y ago)614[1 issues](https://github.com/ryanwinchester/carbonize/issues)MITPHPPHP ^5.6|^7.0

Since Oct 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ryanwinchester/carbonize)[ Packagist](https://packagist.org/packages/ryanwinchester/carbonize)[ RSS](/packages/ryanwinchester-carbonize/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

Carbonize
=========

[](#carbonize)

[![Packagist](https://camo.githubusercontent.com/ec7e5eb6129f3cb3228340447f8f3810f5c0fa60e563f78e56a24204a4e2146b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7279616e77696e636865737465722f636172626f6e697a652e737667)](https://packagist.org/packages/ryanwinchester/carbonize)[![Build Status](https://camo.githubusercontent.com/0bb235c59a57297041e143210f25b651fc954e7299011fe55749ef4ced9b93ce/68747470733a2f2f7472617669732d63692e6f72672f7279616e77696e636865737465722f636172626f6e697a652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ryanwinchester/carbonize)[![Codecov](https://camo.githubusercontent.com/df833cb075202b922181cf888d070088acfff53b4dbd41836f9a2cdb34a81bda/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f7279616e77696e636865737465722f636172626f6e697a652e737667)](https://codecov.io/gh/ryanwinchester/carbonize)[![Maintainability](https://camo.githubusercontent.com/ac03375c3b07015ba402c93bd276c26058034ce751ab52250a903507c1e33869/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36643963656132316661353332346434386363612f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/ryanwinchester/carbonize/maintainability)

[Carbon](https://github.com/briannesbitt/Carbon) helper for creating new instances of Carbon from other Carbon objects, DateTime|Immutable objects, date strings, timestamps, or null (for `now`).

Sometimes we have to work on projects that already exist or are underway, that are full of magic and inconsistent date formats. Is this going to be a timestamp? a date string? a Carbon instance? Does it even matter as long as it's a datetime of some sort? ¯\\\_(ツ)\_/¯

```
    public function doMyThing($datetime)
    {
        // Whatever it was, it is _now_ a NEW carbon instance
        $datetime = carbonize($datetime);

        // do stuff with your carbon instance
    }
```

You can use it as either `carbonize()`, `carbon()`, or `Carbonize\Carbonize::toCarbon()`.

Install
-------

[](#install)

```
composer require ryanwinchester/carbonize

```

This does not install carbon as a dependency, so add it yourself.

**Important Note:** Please use Carbon 1.21 (not 1.22) until timezones are fixed. ([briannesbitt/Carbon#863](https://github.com/briannesbitt/Carbon/issues/863))

What it does
------------

[](#what-it-does)

```
carbonize() == Carbon::now("UTC");

$carbon = new Carbon();
carbonize($carbon) == $carbon->copy();

$dt = new DateTime();
carbonize($dt) == Carbon::instance($dt);

$dtImmutable = new DateTimeImmutable();
carbonize($dtImmutable) == Carbon::instance(new DateTime($dtImmutable->format(DateTime::ATOM)));

carbonize(1507957785) == Carbon::createFromTimestamp(1507957785, "UTC");

carbonize("1507957785") == Carbon::createFromTimestamp(1507957785, "UTC");

carbonize("2017-01-01 12:04:01") == Carbon::parse("2017-01-01 12:04:01", "UTC");

carbonize("3 months ago") == Carbon::parse("3 months ago", "UTC");
```

License
-------

[](#license)

MIT

Credits
-------

[](#credits)

- **Carbon** ()

Notes
-----

[](#notes)

Although Carbon is decent, use [Chronos](https://github.com/cakephp/chronos) if you can. ()

&lt;3 Chronos, Immutability FTW ᕙ(⇀‸↼‶)ᕗ

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

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

Every ~0 days

Total

2

Last Release

3134d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f839bc1a48d9699534fdfd618ad477afe371e9ce70c76885a5cb851895ab7289?d=identicon)[ryanwinchester](/maintainers/ryanwinchester)

---

Top Contributors

[![ryanwinchester](https://avatars.githubusercontent.com/u/2897340?v=4)](https://github.com/ryanwinchester "ryanwinchester (27 commits)")[![rmikalkenas](https://avatars.githubusercontent.com/u/14221532?v=4)](https://github.com/rmikalkenas "rmikalkenas (1 commits)")

---

Tags

carbondatetimephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ryanwinchester-carbonize/health.svg)

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

###  Alternatives

[ashallendesign/short-url

A Laravel package for creating shortened URLs for your web apps.

1.4k1.9M4](/packages/ashallendesign-short-url)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

52664.9k12](/packages/solspace-craft-freeform)[intervention/zodiac

Zodiac Sign Calculator

58191.7k](/packages/intervention-zodiac)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[solspace/craft-calendar

The most powerful event management and calendaring plugin!

1830.8k1](/packages/solspace-craft-calendar)

PHPackages © 2026

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