PHPackages                             coonlink/ton-to-usd-converter - 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. coonlink/ton-to-usd-converter

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

coonlink/ton-to-usd-converter
=============================

Client-side TON to USD converter using live rates from api.coonlink.fun

v1.0.0-beta(1y ago)10MITJavaScriptCI failing

Since Mar 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/coonlink/ton-to-usd-converter)[ Packagist](https://packagist.org/packages/coonlink/ton-to-usd-converter)[ RSS](/packages/coonlink-ton-to-usd-converter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

TON to USD Converter
====================

[](#ton-to-usd-converter)

💸 Convert any DOM element with `data-tonToUsdPrice` into a compact USD format using the live TON price from the [coonlink API](https://api.coonlink.fun).

---

📦 Installation
--------------

[](#-installation)

Install via Composer:

```
composer require coonlink/ton-to-usd-converter
```

If you're using Laravel or another PHP framework, you can publish or link the JS file like this:

```

```

Or include it directly via CDN (if you host it yourself or use jsDelivr/GitHub Pages):

```

```

---

💡 Usage
-------

[](#-usage)

In your HTML, use the `data-tonToUsdPrice` attribute on any element:

```
0
```

When the script runs, it will fetch the current TON→USD rate and update the content automatically:

```
$169.25

```

You can optionally specify a custom rate via `data-tonToUsdRate`:

```
0
```

---

🔁 Manual Update (Optional)
--------------------------

[](#-manual-update-optional)

The script automatically runs on page load and listens for DOM changes, but you can also trigger it manually:

```
window.updateTonToUsdPrices(); // Immediate refresh

// Or dispatch a custom event
window.dispatchEvent(new Event('updateTonPrices'));
```

---

⚙️ How It Works
---------------

[](#️-how-it-works)

- Fetches current TON→USD rate from:
    `https://api.coonlink.fun/v1/ton/rate`
- Caches the rate for 60 seconds
- Finds all elements with `data-tonToUsdPrice`
- Multiplies the amount × rate
- Outputs a compact USD format:
    - `$1.23K`, `$45.67M`, etc.
- Supports dynamic DOM updates via `MutationObserver`

---

🧪 Example
---------

[](#-example)

```
0
0
0
```

Outputs something like:

```
$400.00
$222.00
$24.60

```

---

🛡 License
---------

[](#-license)

MIT © [Coonlink](https://coonlink.fun)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance47

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 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

408d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/28f92808f4fb8277ff7803d66563b4e8a8330e44c3d00367c4d7113c9da7407d?d=identicon)[coonlink](/maintainers/coonlink)

---

Top Contributors

[![crc137](https://avatars.githubusercontent.com/u/165967398?v=4)](https://github.com/crc137 "crc137 (12 commits)")

### Embed Badge

![Health badge](/badges/coonlink-ton-to-usd-converter/health.svg)

```
[![Health](https://phpackages.com/badges/coonlink-ton-to-usd-converter/health.svg)](https://phpackages.com/packages/coonlink-ton-to-usd-converter)
```

PHPackages © 2026

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