PHPackages                             gryfoss/int-combiner - 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. gryfoss/int-combiner

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

gryfoss/int-combiner
====================

Allows easy concatenation of ints without conversion through strings.

v1.1.0(7mo ago)196MITPHPCI passing

Since Sep 17Pushed 7mo agoCompare

[ Source](https://github.com/GryfOSS/int-combiner)[ Packagist](https://packagist.org/packages/gryfoss/int-combiner)[ RSS](/packages/gryfoss-int-combiner/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

IntCombiner
===========

[](#intcombiner)

[![Tests](https://github.com/GryfOSS/int-combiner/workflows/Tests%20and%20Coverage/badge.svg)](https://github.com/GryfOSS/int-combiner/workflows/Tests%20and%20Coverage/badge.svg)[![PHP Version](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)](https://camo.githubusercontent.com/187240af044d09d5b14a1d9d9ebdf3f7a993e4c7bc09bdb46b4ba661a891bf5b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d626c7565)[![Coverage](https://camo.githubusercontent.com/cd0704b56f1d56def350b6d0164316307bb2f47834225fd85443b6fb0059bc73/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d3130302532352d627269676874677265656e)](https://camo.githubusercontent.com/cd0704b56f1d56def350b6d0164316307bb2f47834225fd85443b6fb0059bc73/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f436f7665726167652d3130302532352d627269676874677265656e)

Allows easy concatenation of ints without conversion through strings.

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

[](#installation)

```
composer install
```

Usage
-----

[](#usage)

```
use GryfOSS\Formatter\IntCombiner;

// Combine two positive integers
$result = IntCombiner::combine(123, 456); // Returns: 123456

// Handle edge case where second number is zero
$result = IntCombiner::combine(123, 0); // Returns: 1230 (123 * 10)

// Both numbers must be non-negative
IntCombiner::combine(-1, 5); // Throws InvalidArgumentException
```

Testing
-------

[](#testing)

This project includes comprehensive testing with both **PHPUnit** (unit tests) and **Behat** (behavior-driven testing) to ensure 100% code coverage and validate all behavioral scenarios.

### Unit Testing with PHPUnit

[](#unit-testing-with-phpunit)

Run PHPUnit tests with the following commands:

```
# Run unit tests
composer test

# Run tests with coverage report
composer test-coverage

# Generate HTML coverage report
composer test-coverage-html
```

### Behavior-Driven Testing with Behat

[](#behavior-driven-testing-with-behat)

Run Behat tests to validate behavioral scenarios:

```
# Run all Behat scenarios
composer behat

# Dry run to validate feature files
composer behat-dry

# Run both PHPUnit and Behat tests
composer test-all
```

### Test Coverage Details

[](#test-coverage-details)

**PHPUnit Unit Tests** cover:

- ✅ Normal integer combination scenarios
- ✅ Edge case when second number is zero (special multiplication logic)
- ✅ Edge case when first number is zero
- ✅ Single digit and multi-digit number combinations
- ✅ Large number combinations
- ✅ Error handling for negative numbers (both first and second parameter)
- ✅ Digit counting logic verification (log10 calculations)
- ✅ Power of 10 calculations for proper concatenation
- ✅ Boundary conditions and edge cases

**Behat BDD Scenarios** cover:

- 🎯 **43 scenarios** with **220 steps** testing real-world usage patterns
- 🔍 **Mathematical properties validation** with digit counting verification
- ⚡ **Performance testing** with large number combinations
- 🚫 **Error scenarios** with comprehensive exception handling
- 📊 **Boundary value testing** with edge cases
- 🧮 **Advanced mathematical logic verification** with documented formulas

### Continuous Integration

[](#continuous-integration)

This project includes a comprehensive GitHub Actions workflow that:

- ✅ **Multi-PHP Testing** - Tests on PHP 8.2, 8.3, and 8.4
- 🧪 **Unit Tests** - Runs PHPUnit tests with Xdebug coverage
- 🎯 **Feature Tests** - Executes all Behat BDD scenarios
- 📊 **Coverage Enforcement** - **Fails if coverage is not 100%**
- 🔍 **Code Quality** - Validates composer files and project structure
- 🚀 **Codecov Integration** - Optional coverage reporting

### Local CI Testing

[](#local-ci-testing)

```
# Run the same checks as GitHub Actions locally
composer ci-local

# Or individual steps
composer validate --strict    # Validate composer.json
composer check-coverage       # Verify 100% coverage requirement
composer behat                # Run feature tests
```

**Current Coverage: 100% (1/1 classes, 1/1 methods, 6/6 lines)**

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

[](#contributing)

We welcome contributions from everyone! Whether you want to report a bug, suggest a feature, or submit code improvements, your input is valuable.

### How to Contribute

[](#how-to-contribute)

#### 🐛 **Report Issues**

[](#-report-issues)

- Found a bug? [Open an issue](https://github.com/GryfOSS/int-combiner/issues/new)
- Include steps to reproduce and expected vs actual behavior
- Provide PHP version and relevant environment details

#### 💡 **Suggest Features**

[](#-suggest-features)

- Have an idea for improvement? [Create a feature request](https://github.com/GryfOSS/int-combiner/issues/new)
- Explain the use case and expected behavior
- Consider backward compatibility implications

#### 🔧 **Submit Pull Requests**

[](#-submit-pull-requests)

- Fork the repository and create a feature branch
- Make your changes with appropriate tests
- Ensure **100% test coverage is maintained**
- Run `composer ci-local` to verify all checks pass
- Submit a pull request with clear description of changes

### Development Guidelines

[](#development-guidelines)

- **All code must have 100% test coverage** (both PHPUnit and Behat scenarios)
- Follow existing code style and conventions
- Add tests for new functionality or bug fixes
- Update documentation as needed
- Ensure all GitHub Actions checks pass

### Questions or Discussion

[](#questions-or-discussion)

- Open an [issue](https://github.com/GryfOSS/int-combiner/issues) for questions
- Tag with appropriate labels (question, enhancement, bug, etc.)

Every contribution, no matter how small, helps improve the project for everyone! 🎉

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance65

Regular maintenance activity

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

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

Every ~26 days

Total

2

Last Release

215d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b76a5fac115d24d698d09cc939a6922bf309732ae61d0f2f215ae9e7397658ea?d=identicon)[ideaconnect](/maintainers/ideaconnect)

---

Top Contributors

[![bpacholek](https://avatars.githubusercontent.com/u/3039162?v=4)](https://github.com/bpacholek "bpacholek (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/gryfoss-int-combiner/health.svg)

```
[![Health](https://phpackages.com/badges/gryfoss-int-combiner/health.svg)](https://phpackages.com/packages/gryfoss-int-combiner)
```

###  Alternatives

[phannaly/php-datetime-khmer

The PHP library for convert datetime to Khmer

1510.3k](/packages/phannaly-php-datetime-khmer)[moosend/website-tracking

By installing the Moosend PHP Tracking library you are can track page views, product views, add to cart events and successful purchases. You can later use these details to segment your user base, run automations, check how successful your latest promo has been and how many conversions your landing page has led to.

1020.9k1](/packages/moosend-website-tracking)

PHPackages © 2026

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