PHP Classes

File: README.md

Recommend this page to a friend!
  Packages of Christos Drogidis   TCurrencyHandler   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Documentation
Class: TCurrencyHandler
Retrieve details and format currency symbol values
Author: By
Last change: Initial
Date: 1 month ago
Size: 4,512 bytes
 

Contents

Class file image Download

ASCOOS OS ? TCurrencyHandler

A complete, modular currency management handler for the ASCOOS Web Operating System.

The class is part of the collection of about 1,500 classes that make up the ASCOOS OS.

Ascoos

Table of Contents

Overview

TCurrencyHandler is the first publicly released class (with open source) of ASCOOS OS, designed to demonstrate:

  • the architecture and coding style of the ASCOOS Kernel
  • the optional classes dynamic loading system (Extras Classes Manager)
  • the DoBu documentation technology
  • and a fully functional, production?ready currency management module

This class provides:

  • currency symbols
  • currency names (EN/EL)
  • formatting rules
  • validation
  • normalization (aliases)
  • crypto support
  • ISO?4217 support (active + deprecated)

Features

  • ? ISO?4217 currency support
  • ? Deprecated currency support
  • ? Crypto currency support
  • ? Multilingual names (EN/EL)
  • ? Symbol lookup
  • ? Amount formatting
  • ? Normalization via aliases
  • ? Validation
  • ? UTF?8 safe
  • ? Fully documented with DoBu
  • ? Optional loading via Extras Manager

Installation

This class is part of the ASCOOS OS Extras Kernel Classes system and does not require installation as it already exists in the kernel.

Namespace

use ASCOOS\OS\Kernel\Science\Financials\TCurrencyHandler;

Management

It is loaded dynamically by the internal app Extras Classes Manager, depending on user configuration.

ASCOOS OS

DoBu Documentation

This repository includes full DoBu docblocks for:

  • the file with the class and the example file
  • the class
  • each method
  • parameters
  • return types
  • exceptions
  • multilingual descriptions

DoBu is the official documentation DSL of ASCOOS OS.

DoBu documentation in the example file

/*
dobu {
    file:id(`expl15435`) {
        ascoos {
            name {`ASCOOS OS`},
            version {`1.0.0`},
        },
        example {
            class {`TCurrencyHandler`}
            source {`example.php`},
            category:langs {
                en {`Financials`},
                el {`?????????? ????????`}
            },
            description:langs {
                en {`A complete example of currency management: symbols, names, formatting, validation.`},
                el {`??? ?????? ?????????? ??????????? ??????????: ???????, ?????????, ???????????, ?????????.`}
            },
            author {`Drogidis Christos`},
            sincePHP {`8.4.0`}
        }
    }
}
*/

Usage Example

use ASCOOS\OS\Kernel\Science\Financials\TCurrencyHandler;

$currency = TCurrencyHandler::getInstance();

// Normalize
echo $currency->normalize('xbt'); // BTC

// Validate
var_dump($currency->isValid('EUR')); // true

// Symbol
echo $currency->getSymbol('USD'); // $

// Name
echo $currency->getName('EUR', 'el'); // ????

// Format
echo $currency->format(1234.56, 'EUR'); // 1.234,56 ?

See the full example: example.php which produces the following result

ASCOOS OS

Architecture Notes

ASCOOS OS uses a Full Modular Kernel Architecture:

  • Some classes are Deep Core Kernel (always loaded)
  • Others are Extras (optional, dynamically loaded)
  • Namespace does not reflect physical path
  • Extras Manager handles: - dependency resolution - selective loading - performance optimization

TCurrencyHandler is a Kernel Science class, but loaded as an Extra.

License

AGL (ASCOOS General License)

Author

Drogidis Christos ASCOOS OS Creator https://www.ascoos.com