Skip to content

Releases: nanasess/bcmath-polyfill

v1.0.2

04 Dec 08:01
9f06ad6

Choose a tag to compare

What's Changed

🚀 New Features

PHP 8.5 Support

  • Add PHP 8.5 to CI/CD test matrix across all platforms (Ubuntu, Windows, macOS)
  • Verified compatibility with PHP 8.5 for all bcmath polyfill functions
  • Skip gh20006 test for PHP 8.5 (requires BcMath\Number OOP API not yet implemented in polyfill)
  • Update documentation to reflect PHP 8.5 support

Benchmarking Framework

  • Add comprehensive performance benchmarking tool for comparing polyfill vs native bcmath
  • Support multiple output formats: console, JSON, CSV, and Markdown
  • GitHub Actions integration:
    • PR Benchmarks: Comment /benchmark on PRs for quick performance tests (1,000 iterations)
    • Merge Benchmarks: Automatic full benchmark on PR merge (10,000 iterations)
    • Manual Benchmarks: Trigger via GitHub Actions UI with customizable settings
  • Test all bcmath operations with various number sizes and precision scales

🔧 Improvements

Code Quality

  • Apply Rector code modernization rules:
    • Use in_array() with strict comparison
    • Adopt first-class callables syntax
    • Enhance type safety throughout codebase
  • Add explicit type declarations to all function parameters (string, ?int)
  • Remove redundant PHPDoc annotations

CI/CD Enhancements

  • Fix PHPStan configuration for expr.resultUnused error handling
  • Improve workflow reliability with file-based approach for PR comments
  • Fix backtick escaping in benchmark comment formatting
  • Remove redundant condition checks in workflows

Documentation

  • Add comprehensive performance benchmarking guide to README
  • Document GitHub Actions benchmark workflows
  • Update supported PHP versions list (8.1, 8.2, 8.3, 8.4, 8.5)

📊 Testing

All 57 CI checks passing across:

  • 3 operating systems (Ubuntu, Windows, macOS)
  • 5 PHP versions (8.1, 8.2, 8.3, 8.4, 8.5)
  • With and without bcmath extension
  • Docker PHPT tests using official PHP test suite

🔗 Links

  • Full Changelog: 1.0.1...1.0.2
  • Benchmark Documentation: See README.md "Performance" section
  • PHP 8.5 CI Results: All tests passing ✅

👥 Contributors

@nanasess

v1.0.1

11 Sep 08:13
a9a5884

Choose a tag to compare

What's Changed

  • Fix zero handling in BCMath division and power operations by @nanasess in #31
  • Fix BCMath::sqrt negative validation and algorithm precision issues by @nanasess in #32
  • ci(deps): bump stefanzweifel/git-auto-commit-action from 5 to 6 by @dependabot[bot] in #33
  • chore: remove legacy configuration files by @nanasess in #34
  • Add PHP 8.4 RoundingMode enum support with polyfill compatibility by @nanasess in #35
  • feat: Add Docker-based PHPT test runner for comprehensive bcmath polyfill testing by @nanasess in #37
  • feat: comprehensive Docker PHPT test infrastructure and BCMath improvements by @nanasess in #38

Full Changelog: 1.0.0...1.0.1

v1.0.0

05 Sep 08:55
4683616

Choose a tag to compare

v1.0.0 Pre-release
Pre-release

What's Changed

  • docs: add comparison with phpseclib/bcmath_compat to README by @nanasess in #16
  • ci(github): add Dependabot configuration for Composer and GitHub Actions by @nanasess in #18
  • feat: add comprehensive development tools and improve code quality by @nanasess in #20
  • Add tests for BCMath polyfill without bcmath extension by @nanasess in #22
  • Add Claude Code GitHub Workflow by @nanasess in #24
  • ci(deps): bump actions/checkout from 4 to 5 by @dependabot[bot] in #19
  • refactor(BCMath): major architecture refactoring with DRY principle and unified structure by @nanasess in #25
  • Add PHP-src BCMath Tests Integration by @nanasess in #27
  • Major BCMath Architecture Improvements - Issue #26 by @nanasess in #28
  • feat: implement comprehensive ValueError validation for bcmath functions (resolves #12) by @nanasess in #29

New Contributors

Full Changelog: 0.0.1...1.0.0

v0.0.1

16 Jul 08:56
e989847

Choose a tag to compare

v0.0.1 Pre-release
Pre-release

bcmath-polyfill v0.0.1

The first stable release of bcmath-polyfill, a fork of phpseclib/bcmath_compat with groundbreaking PHP 8.4 support and enhanced functionality.

🔄 Key Differences from phpseclib/bcmath_compat

🆕 PHP 8.4 Support (Major Enhancement)

bcmath-polyfill is the FIRST and ONLY bcmath polyfill supporting PHP 8.4's new functions:

  • bcfloor() - Round down to nearest integer
  • bcceil() - Round up to nearest integer
  • bcround() - Round to specified precision with multiple rounding modes
    • Supports all PHP rounding modes: HALF_UP, HALF_DOWN, HALF_EVEN, HALF_ODD
    • Handles negative scale parameters correctly

🐛 Bug Fixes and Improvements

  • Fixed bcscale() state pollution in test environments
  • Fixed PHP 8.2+ deprecation warnings for dynamic properties
  • Improved error handling with proper PHP version detection
  • Enhanced scale parameter handling for more consistent behavior

📦 Package and Maintenance

  • Actively maintained with regular updates
  • Modern CI/CD with GitHub Actions including PHP 8.4 in test matrix
  • Renamed package from phpseclib/bcmath_compat to nanasess/bcmath-polyfill
  • Enhanced documentation with comprehensive README and examples

🚀 Performance and Compatibility

  • Same lightweight approach - Zero production dependencies beyond phpseclib
  • 100% backward compatible - Drop-in replacement for phpseclib/bcmath_compat
  • PHP 8.1+ focused - Optimized for modern PHP versions

📊 Comparison Table

Feature phpseclib/bcmath_compat bcmath-polyfill v0.0.1
PHP 8.4 functions ❌ Not supported ✅ Full support
bcfloor()
bcceil()
bcround()
PHP 8.2+ deprecations ⚠️ Warnings ✅ Fixed
Test suite pollution ⚠️ Issues ✅ Fixed
Active maintenance ❌ Limited ✅ Active
CI/CD (PHP versions) GitHub Actions (8.1, 8.2, 8.3) GitHub Actions (8.1, 8.2, 8.3, 8.4)

🔧 Migration Guide

Switching from phpseclib/bcmath_compat is seamless:

# Remove old package
composer remove phpseclib/bcmath_compat

# Install bcmath-polyfill
composer require nanasess/bcmath-polyfill

No code changes required - all existing functions work identically, plus you get PHP 8.4 features!

✨ New PHP 8.4 Function Examples

// New in PHP 8.4 - Only available in bcmath-polyfill!
$floor = bcfloor('2.9');                    // "2"
$ceil = bcceil('2.1');                      // "3"
$rounded = bcround('3.14159', 2);           // "3.14"
$rounded_half_down = bcround('2.55', 1, PHP_ROUND_HALF_DOWN); // "2.5"

🎯 Why Choose bcmath-polyfill?

  1. Future-proof - Ready for PHP 8.4 today
  2. Battle-tested - Built on phpseclib's proven foundation
  3. Actively maintained - Regular updates and bug fixes
  4. Community-driven - Open to contributions and feedback

📦 Installation

composer require nanasess/bcmath-polyfill

👥 Credits

  • Jim Wigginton - Original phpseclib/bcmath_compat author
  • Kentaro Ohkouchi (@nanasess) - Fork maintainer and PHP 8.4 implementation

📄 License

MIT License


Full Changelog: Forked from phpseclib/bcmath_compat with 23 new commits
Repository: https://github.com/nanasess/bcmath-polyfill