rizky92 / carbon-helper
Helper for nesbot/carbon
Installs: 141
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/rizky92/carbon-helper
Requires
- nesbot/carbon: ^2.0
This package is auto-updated.
Last update: 2025-10-21 18:17:04 UTC
README
A simple global helper methods for nesbot/carbon
Installation
composer require rizky92/carbon-helper
Usage
You may call carbon or carbon_immutable anywhere in your code base like so:
$date = carbon('23-08-2023'); echo $date; // 2023-08-23 00:00:00.0 Asia/Makassar (+08:00)
carbon
Calling carbon method will create a Carbon instance, in which it will change the underlying date value if you chain call methods on it.
$christmas = carbon('December 25, 2022'); $christmas->addDays(6); echo $christmas; // 2022-12-31 00:00:00.0 Asia/Makassar (+08:00)
carbon_immutable
Calling carbon_immutable will create a CarbonImmutable instance that does not change the underlying date value, but will return a new instance with modified value everytime you chain call methods on it.
$christmas = carbon_immutable('December 25, 2022'); $christmas->addDays(6); echo $christmas; // 2022-12-25 00:00:00.0 Asia/Makassar (+08:00)
License
MIT