README.md 1.67 KB

How to use package

1) Add repository to composer.json

"repositories": [
  {
    "type": "vcs",
    "url": "git@gitlab.monotos.biz:pvduc/daito-utils.git"
  }
]

2) Install package

Stable (recommended - install by tag)

composer require daito/lib:^1.0

Dev (testing latest branch code)

composer require daito/lib:dev-master

3) Update package

Stable

composer update daito/lib

Dev branch

composer update daito/lib

Release by tag

After code is ready on release branch (for example production), create and push tag:

git tag v1.0.0
git push origin v1.0.0

Then projects using this package can update to the new stable version:

composer require daito/lib:^1.0
# or
composer update daito/lib

Performance note (DaitoMath)

DaitoMath uses brick/math for precise decimal calculations (financial-safe).

  • It can run without extra PHP extensions.
  • For better performance on production, enable one of:
    • ext-gmp (recommended)
    • ext-bcmath
  • brick/math will automatically use the fastest available calculator at runtime.

Quick check:

php -m | grep -Ei "gmp|bcmath"

Install extensions if missing:

# Ubuntu / Debian
sudo apt-get update
sudo apt-get install -y php-gmp php-bcmath
sudo systemctl restart php8.2-fpm || sudo systemctl restart apache2
# CentOS / RHEL / Rocky / AlmaLinux
sudo yum install -y php-gmp php-bcmath
sudo systemctl restart php-fpm || sudo systemctl restart httpd
# Windows (php.ini)
# 1) Open php.ini
# 2) Enable these lines:
extension=gmp
extension=bcmath
# 3) Restart web server / PHP-FPM service