PHPackages                             wamadev/radon - 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. wamadev/radon

Abandoned → [alitnk/radon](/?search=alitnk%2Fradon)ArchivedLibrary

wamadev/radon
=============

:package\_description

v1.0.1(4y ago)44MITPHP

Since Jul 11Pushed 4y agoCompare

[ Source](https://github.com/alitnk/radon)[ Packagist](https://packagist.org/packages/wamadev/radon)[ Docs](https://github.com/wamadev/radon)[ RSS](/packages/wamadev-radon/feed)WikiDiscussions main Synced 5d ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

Radon
=====

[](#radon)

[![Total Downloads](https://camo.githubusercontent.com/9435fcfbcc8bd83d28d525e922a60a0accb5ba061bce471f580b4378ee743017/687474703a2f2f706f7365722e707567782e6f72672f616c69746e6b2f7261646f6e2f646f776e6c6f616473)](https://packagist.org/packages/alitnk/radon)[![Version](https://camo.githubusercontent.com/f4c2010c67bba613cc546730597a1eb3edaf8f08d17c916763f7e7231b74a2dd/687474703a2f2f706f7365722e707567782e6f72672f616c69746e6b2f7261646f6e2f76657273696f6e)](https://packagist.org/packages/alitnk/radon)[![License](https://camo.githubusercontent.com/7e01fa9512ae79e71ba0dd98634fb13d4f70084b452bb9d769366faad60a71dc/687474703a2f2f706f7365722e707567782e6f72672f616c69746e6b2f7261646f6e2f6c6963656e7365)](https://packagist.org/packages/alitnk/radon)

A library like [Carbon](https://github.com/briannesbitt/Carbon) but for Iranian (Jalali) calendar

Installation
------------

[](#installation)

Via Composer

```
$ composer require alitnk/radon
```

Usage
-----

[](#usage)

### Create new instance

[](#create-new-instance)

Just like when you would do `now()` and get a Carbon instance, you can do `jnow()` and get a Radon instance for the current time.

To make a new instance based on the given datetime, you can use `radon($datetimeString)` like: `$r = radon('1401-12-28 06:15')`and get a new instance for that datetime

### Conversions

[](#conversions)

To convert Carbon instances to Radon instances, do:

```
$carbonInstance->toJalali(); // returns Radon instance and converts the date from gregorian to jalali

```

To do the vice versa (Radon to Carbon), do:

```
$radonInstance->toGregorian(); // returns Carbon instance and converts the date from jalali to gregorian

```

### Methods

[](#methods)

You can use most of the carbon's methods on a Radon instance. e.g. `$radonInstance->diffForHumans()`, `$radonInstance->addDay(10)`, `$radonInstance->setDay(1)`

### Eloquent / Querying

[](#eloquent--querying)

Radon introduces new querying features for Jalali dates. Available methods are:

#### whereBetweenJalali

[](#wherebetweenjalali)

Note that this method is also available on `Collection` objects.

Example:

```
Product::whereBetweenJalali('created_at', [radon('1398-10-12'), radon('1398-11-12')])->get();
```

#### orWhereBetweenJalali

[](#orwherebetweenjalali)

This method is like `orWhereBetween` but for Jalali dates.

#### whereDateJalali

[](#wheredatejalali)

```
Comment::whereDateJalali('created_at', radon('1400-01-01'))->get(); // Gets all the comments for first day of 1400
```

#### whereDayJalali

[](#wheredayjalali)

Compares the day

```
Comment::whereDayJalali('created_at', 31); // Gets all comments for 31th
```

#### whereMonthJalali

[](#wheremonthjalali)

Compares the month

```
Comment::whereMonthJalali('created_at', 1); // Gets all of Farvardin's comments
```

#### whereYearJalali

[](#whereyearjalali)

Compares the year

```
Comment::whereYearJalali('created_at', 1400); // Gets all of 1400's comments
```

### Casts

[](#casts)

You can use the Radon cast to make the conversion process easier. To use the cast, add the cast to your field in the respective model:

```
use Wama\Radon\Casts\JalaliDatetime;

class Product extends Model {
  protected $casts = [
    'sales_ends_at' => JalaliDatetime::class,
    'updated_at' => JalaliDatetime::class,
    'created_at' => JalaliDatetime::class,
  ];
}
```

and get a Radon instance every time you get the field. `$product->sales_ends_at // returns a Radon instance`

you can also update the model without having to worry about the datetime conversions:

```
$product->update([
  'sales_ends_at' => radon('1401-01-14 23:00'), // Sales will end at Farvardin 14th
]);
```

or

```
$product->sales_ends_at->addMonth();
$product->save();
```

Expansion
---------

[](#expansion)

Radon tries to support most of the Carbon methods, but keep in mind that some of the Carbon methods are not supported *yet* and might be added in the next versions. This package uses [Verta](https://github.com/hekmatinasser/verta) under the hood and therefore, expanding some functionalities might demand on the expansion of Verta.

Change log
----------

[](#change-log)

Please see the [changelog](changelog.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

If you discover any security related issues, please email author email instead of using the issue tracker.

Credits
-------

[](#credits)

- [Alireza Zamani](https://github.com/alitnk)
- [All Contributors](../../contributors)

License
-------

[](#license)

license. Please see the [license file](LICENSE) for more information.

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity52

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

Every ~0 days

Total

2

Last Release

1770d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4dff6aaa9372c95a1454f04f160d2d9b02c23e77a9225a3d06bc4092a455c995?d=identicon)[alitnk](/maintainers/alitnk)

---

Top Contributors

[![cerpinn](https://avatars.githubusercontent.com/u/35243344?v=4)](https://github.com/cerpinn "cerpinn (21 commits)")

---

Tags

carboniraniranianjalalijalali-datejalali-datetimelaravelpersianphpshamsishamsi-datelaravelcarbonjalali\_dateshamsi-dateRadonIranian Dateتاریخ شمسی

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/wamadev-radon/health.svg)

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

###  Alternatives

[iamfarhad/validation

🇮🇷 Complete Laravel Persian validation package - Iranian national ID, mobile numbers, Shamsi dates, IBAN/Sheba, postal codes &amp; more. Modern Laravel 10-12 support with both ValidationRule objects &amp; string-based rules.

2917.3k](/packages/iamfarhad-validation)

PHPackages © 2026

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