git404hub

what is carbon fr?

briannesbitt/carbon — explained in plain English

Analysis updated 2026-06-24

16,617PHPAudience · developerComplexity · 2/5Setup · easy

tl;dr

A PHP library that makes working with dates and times easier than the built-in DateTime class, with English-style methods, time zones, and 200+ languages.

vibe map

mindmap
  root((Carbon))
    Inputs
      Dates and times
      Time zones
      Locale names
    Outputs
      Formatted timestamps
      Human readable diffs
      Parsed Carbon objects
    Use Cases
      Add and subtract dates
      Format dates for display
      Compare two timestamps
      Mock the current time in tests
    Tech Stack
      PHP
      Composer
      DateTime

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Add or subtract days, weeks, or months from a date in a PHP app

VIBE 2

Show a timestamp as a human phrase like 2 minutes ago in many languages

VIBE 3

Mock the current time in unit tests for date-dependent logic

VIBE 4

Convert between time zones when displaying user timestamps

what's the stack?

PHPComposerDateTime

how it stacks up fr

briannesbitt/carbonflarum/flarumkoel/koel
Stars16,61716,27417,135
LanguagePHPPHPPHP
Setup difficultyeasymoderatemoderate
Complexity2/53/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · easy time til it works · 5min

in plain english

briannesbitt/Carbon is a PHP library that makes working with dates and times much easier than using PHP's built-in tools alone. PHP has a built-in "DateTime" class for handling dates and times, but it can be clunky to use for common tasks. Carbon extends that class with a much friendlier set of methods, simple English-style calls that let you do things like add a day, subtract a week, compare two dates, or format a timestamp. The code examples in the README demonstrate the style well: you can get the current time with Carbon::now(), add a day with ->addDay(), subtract a week with ->subWeek(), get a person's age from a birthdate, and express time differences in plain language like "2 minutes ago." It supports over 200 languages and 500 regional variants, so that "2 minutes ago" message can be displayed in Chinese, French, or dozens of other languages automatically. It also includes a useful feature for testing: you can tell Carbon to pretend the current time is a specific date. This lets you write automated tests that check date-dependent logic without waiting for real time to pass or hardcoding fake dates throughout your code. Carbon is written in PHP and installed via Composer, which is the standard PHP package manager. You would use it in any PHP project where you need to do date arithmetic, format dates for display, compare timestamps, or handle time zones, common needs in web apps, scheduling systems, or anything that tracks events over time.

prompts (copy fr)

prompt 1
Show me how to install Carbon with Composer and print the current time in Tokyo and New York
prompt 2
Write a PHP function using Carbon that returns a persons age from a birthdate string
prompt 3
Give me a Carbon snippet that formats a timestamp as 2 minutes ago in French
prompt 4
Show how to use Carbon::setTestNow to mock time inside a PHPUnit test
prompt 5
Convert this date math code from raw DateTime to Carbon equivalents

Frequently asked questions

what is carbon fr?

A PHP library that makes working with dates and times easier than the built-in DateTime class, with English-style methods, time zones, and 200+ languages.

What language is carbon written in?

Mainly PHP. The stack also includes PHP, Composer, DateTime.

How hard is carbon to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is carbon for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.