PHPackages                             ceytek-labs/tcmb-services-lite - 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. [API Development](/categories/api)
4. /
5. ceytek-labs/tcmb-services-lite

ActiveLibrary[API Development](/categories/api)

ceytek-labs/tcmb-services-lite
==============================

A lightweight library for retrieving exchange rates and other data from TCMB's APIs.

v1.3.8(1y ago)05MITPHPPHP ^8.1

Since Sep 21Pushed 1y agoCompare

[ Source](https://github.com/ceytek-labs/tcmb-services-lite)[ Packagist](https://packagist.org/packages/ceytek-labs/tcmb-services-lite)[ Docs](https://github.com/ceytek-labs/tcmb-services-lite)[ RSS](/packages/ceytek-labs-tcmb-services-lite/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelogDependenciesVersions (21)Used By (0)

[🇹🇷 Türkçe sürüm için buraya tıklayın](README.tr.md)

 [![TCMB Services Lite](https://raw.githubusercontent.com/ceytek-labs/tcmb-services-lite/refs/heads/1.x/art/banner.png)](https://raw.githubusercontent.com/ceytek-labs/tcmb-services-lite/refs/heads/1.x/art/banner.png)

 [![Total Downloads](https://camo.githubusercontent.com/c71cee6cd7866221ea82bb4f0d916b517720c03c4874d508653adf3aaa583d45/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63657974656b2d6c6162732f74636d622d73657276696365732d6c697465)](https://packagist.org/packages/ceytek-labs/tcmb-services-lite) [![Latest Version](https://camo.githubusercontent.com/922a4fc2e5b471b9f1d3510013e464389caeb651171344889668d2bec94c5119/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63657974656b2d6c6162732f74636d622d73657276696365732d6c697465)](https://packagist.org/packages/ceytek-labs/tcmb-services-lite) [![Size](https://camo.githubusercontent.com/bed755cba062b2a0f732fe62ff7fa3040fbe14336ed28279010d6b062b9ae8e2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f63657974656b2d6c6162732f74636d622d73657276696365732d6c697465)](https://packagist.org/packages/ceytek-labs/tcmb-services-lite) [![License](https://camo.githubusercontent.com/e54cc5b600247c30292314c03e54e48fcf8fb4aa496ede36f9def7f7864513a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f63657974656b2d6c6162732f74636d622d73657276696365732d6c697465)](https://packagist.org/packages/ceytek-labs/tcmb-services-lite)

---

TCMB Services Lite
==================

[](#tcmb-services-lite)

The TCMB (Central Bank of the Republic of Turkey) Services Lite is designed to help you easily utilize various data and APIs provided by the TCMB. Currently, it offers the feature of fetching exchange rates, but it can be expanded in the future to include other APIs from the TCMB.

> **Disclaimer:** This package is not an official product of Central Bank of the Republic of Türkiye (Türkiye Cumhuriyet Merkez Bankası). The developers accept no responsibility for any issues, discrepancies, or damages that may arise from its use.

Requirements
------------

[](#requirements)

- PHP 8.1 or higher

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

[](#installation)

You can add this package to your projects using Composer:

```
composer require ceytek-labs/tcmb-services-lite
```

Services
--------

[](#services)

- [TCMB Exchange Rates](#tcmb-exchange-rates)
    - [Display Raw XML Result from the API](#tcmb-exchange-rates-display-raw-xml-result-from-the-api)
    - [Display Raw JSON Result from the API](#tcmb-exchange-rates-display-raw-json-result-from-the-api)
    - [Formatting Exchange Rates](#tcmb-exchange-rates-formatting-exchange-rates)
    - [Getting All Exchange Rates](#tcmb-exchange-rates-getting-all-exchange-rates)
    - [Getting a Specific Currency](#tcmb-exchange-rates-getting-a-specific-currency)
    - [Accessing Currency Information](#tcmb-exchange-rates-accessing-currency-information)
    - [Displaying All Data in Object Format](#tcmb-exchange-rates-displaying-all-data-in-object-format)
    - [Displaying All Data in Array Format](#tcmb-exchange-rates-displaying-all-data-in-array-format)
    - [Supported Currencies](#tcmb-exchange-rates-supported-currencies)

TCMB Exchange Rates
-------------------

[](#tcmb-exchange-rates)

The **TCMB Exchange Rates** retrieves daily exchange rates from the Central Bank of Turkey, providing easy access to various currency information.

### Example Usage

[](#example-usage)

Here are a few examples of how you can use the **TCMB Exchange Rates** class in your PHP projects

**[⬆ Back to services](#services)**

#### TCMB Exchange Rates: Display Raw XML Result from the API

[](#tcmb-exchange-rates-display-raw-xml-result-from-the-api)

```
use CeytekLabs\TcmbServicesLite\TcmbExchangeRates;

// Displays the raw XML result from the API
echo TcmbExchangeRates::make()->response();
```

**[⬆ Back to services](#services)**

#### TCMB Exchange Rates: Display Raw JSON Result from the API

[](#tcmb-exchange-rates-display-raw-json-result-from-the-api)

```
use CeytekLabs\TcmbServicesLite\TcmbExchangeRates;

// Converts the raw XML result from the API to JSON and displays it
echo TcmbExchangeRates::make()->jsonContent();
```

**[⬆ Back to services](#services)**

#### TCMB Exchange Rates: Formatting Exchange Rates

[](#tcmb-exchange-rates-formatting-exchange-rates)

You can receive data from the API in either object or array format. CamelCase is used in object format, and snake\_case is used in array format.

```
use CeytekLabs\TcmbServicesLite\TcmbExchangeRates;
use CeytekLabs\TcmbServicesLite\Enums\Format;

// Getting data in object format
$exchangeRatesObject = TcmbExchangeRates::make()->format(Format::Object)->content();

// Getting data in array format
$exchangeRatesArray = TcmbExchangeRates::make()->format(Format::Array)->content();
```

**[⬆ Back to services](#services)**

#### TCMB Exchange Rates: Getting All Exchange Rates

[](#tcmb-exchange-rates-getting-all-exchange-rates)

```
use CeytekLabs\TcmbServicesLite\TcmbExchangeRates;
use CeytekLabs\TcmbServicesLite\Enums\Format;

// Getting all exchange rates in object format
$currenciesObject = TcmbExchangeRates::make()->format(Format::Object)->currencies();

// Getting all exchange rates in array format
$currenciesArray = TcmbExchangeRates::make()->format(Format::Array)->currencies();
```

**[⬆ Back to services](#services)**

#### TCMB Exchange Rates: Getting a Specific Currency

[](#tcmb-exchange-rates-getting-a-specific-currency)

You can use the `currency()` method to get data for a specific currency.

```
use CeytekLabs\TcmbServicesLite\TcmbExchangeRates;
use CeytekLabs\TcmbServicesLite\Enums\Format;
use CeytekLabs\TcmbServicesLite\Enums\Currency;

// For example, getting the Australian Dollar (AUD) rate
$australianDollar = TcmbExchangeRates::make()
    ->format(Format::Object)
    ->currency(Currency::AustralianDollar)
    ->find();
```

**[⬆ Back to services](#services)**

#### TCMB Exchange Rates: Accessing Currency Information

[](#tcmb-exchange-rates-accessing-currency-information)

You can access detailed information of a specific currency:

```
use CeytekLabs\TcmbServicesLite\TcmbExchangeRates;
use CeytekLabs\TcmbServicesLite\Enums\Format;
use CeytekLabs\TcmbServicesLite\Enums\Currency;

// Getting information for the USD currency
$exchangeRates = TcmbExchangeRates::make()
    ->format(Format::Object)
    ->currency(Currency::UnitedStatesDollar);

// Currency code
echo $exchangeRates->code(); // "USD"

// Turkish name
echo $exchangeRates->turkishName(); // "ABD DOLARI"

// English name
echo $exchangeRates->englishName(); // "US DOLLAR"

// Unit amount
echo $exchangeRates->unit(); // "1"

// Forex buying rate (The buying rate valid in international markets and digital transactions)
echo $exchangeRates->forexBuying();

// Forex selling rate (The selling rate valid in international markets and digital transactions)
echo $exchangeRates->forexSelling();

// Banknote buying rate (The buying rate valid in cash currency transactions)
echo $exchangeRates->banknoteBuying();

// Banknote selling rate (The selling rate valid in cash currency transactions)
echo $exchangeRates->banknoteSelling();
```

**[⬆ Back to services](#services)**

#### TCMB Exchange Rates: Displaying All Data in Object Format

[](#tcmb-exchange-rates-displaying-all-data-in-object-format)

```
use CeytekLabs\TcmbServicesLite\TcmbExchangeRates;
use CeytekLabs\TcmbServicesLite\Enums\Format;

print_r(TcmbExchangeRates::make()->format(Format::Object)->content());
```

Sample output:

```
stdClass Object
(
    [attributes] => stdClass Object
        (
            [date] => "2024-09-20 15:30"
            [bulletinNumber] => "2024/178"
        )

    [currencies] => stdClass Object
        (
            [USD] => stdClass Object
                (
                    [code] => "USD"
                    [name] => stdClass Object
                        (
                            [tr] => "ABD DOLARI"
                            [en] => "US DOLLAR"
                        )
                    [unit] => "1"
                    [forex] => stdClass Object
                        (
                            [buying] => "33.9531"
                            [selling] => "34.0142"
                        )
                    [banknote] => stdClass Object
                        (
                            [buying] => "33.9293"
                            [selling] => "34.0652"
                        )
                )
            // Other currencies...
        )
)
```

**[⬆ Back to services](#services)**

#### TCMB Exchange Rates: Displaying All Data in Array Format

[](#tcmb-exchange-rates-displaying-all-data-in-array-format)

```
use CeytekLabs\TcmbServicesLite\TcmbExchangeRates;
use CeytekLabs\TcmbServicesLite\Enums\Format;

print_r(TcmbExchangeRates::make()->format(Format::Array)->content());
```

Sample output:

```
Array
(
    [attributes] => Array
        (
            [date] => "2024-09-20 15:30"
            [bulletin_number] => "2024/178"
        )

    [currencies] => Array
        (
            [USD] => Array
                (
                    [code] => "USD"
                    [name] => Array
                        (
                            [tr] => "ABD DOLARI"
                            [en] => "US DOLLAR"
                        )
                    [unit] => "1"
                    [forex] => Array
                        (
                            [buying] => "33.9531"
                            [selling] => "34.0142"
                        )
                    [banknote] => Array
                        (
                            [buying] => "33.9293"
                            [selling] => "34.0652"
                        )
                )
            // Other currencies...
        )
)
```

**[⬆ Back to services](#services)**

#### TCMB Exchange Rates: Supported Currencies

[](#tcmb-exchange-rates-supported-currencies)

The package supports the following currencies:

- 🇺🇸 **USD**: United States Dollar
- 🇦🇺 **AUD**: Australian Dollar
- 🇩🇰 **DKK**: Danish Krone
- 🇪🇺 **EUR**: Euro
- 🇬🇧 **GBP**: British Pound
- 🇨🇭 **CHF**: Swiss Franc
- 🇸🇪 **SEK**: Swedish Krona
- 🇨🇦 **CAD**: Canadian Dollar
- 🇰🇼 **KWD**: Kuwaiti Dinar
- 🇳🇴 **NOK**: Norwegian Krone
- 🇸🇦 **SAR**: Saudi Riyal
- 🇯🇵 **JPY**: Japanese Yen
- 🇧🇬 **BGN**: Bulgarian Lev
- 🇷🇴 **RON**: Romanian Leu
- 🇷🇺 **RUB**: Russian Ruble
- 🇮🇷 **IRR**: Iranian Rial
- 🇨🇳 **CNY**: Chinese Yuan
- 🇵🇰 **PKR**: Pakistani Rupee
- 🇶🇦 **QAR**: Qatari Riyal
- 🇰🇷 **KRW**: South Korean Won
- 🇦🇿 **AZN**: Azerbaijani Manat
- 🇦🇪 **AED**: United Arab Emirates Dirham

Debugging
---------

[](#debugging)

- If the response from the API is invalid or an error occurs, an `Exception` will be thrown.
- If the XML format is invalid, you will receive the following error: `Invalid XML format. Please check TcmbExchangeRates::make()->getResponse()`

Future Plans
------------

[](#future-plans)

This package can be expanded to include other data and services provided by the TCMB, such as:

- **Interest Rates:** Fetching interest rates published by the TCMB.
- **Inflation Data:** Access to current inflation data.
- **Other Financial Data:** Integrating other statistics and reports provided by the TCMB.

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

[](#contributing)

If you'd like to contribute, please send a pull request or report an issue.

License
-------

[](#license)

This project is licensed under the MIT License.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity57

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 ~2 days

Total

20

Last Release

563d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/dd04f7a68c28475cb5493f3d841a7ae95ad200188efb658e1a37e30a5f2ba6db?d=identicon)[ceyhun-celik](/maintainers/ceyhun-celik)

---

Top Contributors

[![ceyhun-celik](https://avatars.githubusercontent.com/u/112348956?v=4)](https://github.com/ceyhun-celik "ceyhun-celik (19 commits)")

---

Tags

banknote-ratescentral-bank-of-turkeycurrencyexchange-ratesfinancial-dataforexlite-libraryphptcmbturkeyphpcurrencyexchange ratesturkeyforextcmblite libraryfinancial dataCentral Bank of Turkeybanknote rates

### Embed Badge

![Health badge](/badges/ceytek-labs-tcmb-services-lite/health.svg)

```
[![Health](https://phpackages.com/badges/ceytek-labs-tcmb-services-lite/health.svg)](https://phpackages.com/packages/ceytek-labs-tcmb-services-lite)
```

###  Alternatives

[coinpaymentsnet/coinpayments-php

A PHP wrapper for the CoinPayments.net v1 API.

55126.2k](/packages/coinpaymentsnet-coinpayments-php)[otherguy/php-currency-api

A PHP API Wrapper to offer a unified programming interface for popular Currency Rate APIs.

2526.2k](/packages/otherguy-php-currency-api)

PHPackages © 2026

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