gryfoss/int-combiner
Composer 安装命令:
composer require gryfoss/int-combiner
包简介
Allows easy concatenation of ints without conversion through strings.
README 文档
README
Allows easy concatenation of ints without conversion through strings.
Installation
composer install
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
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
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
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
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
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
# 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
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
🐛 Report Issues
- Found a bug? Open an issue
- Include steps to reproduce and expected vs actual behavior
- Provide PHP version and relevant environment details
💡 Suggest Features
- Have an idea for improvement? Create a feature request
- Explain the use case and expected behavior
- Consider backward compatibility implications
🔧 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-localto verify all checks pass - Submit a pull request with clear description of changes
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
- Open an issue for questions
- Tag with appropriate labels (question, enhancement, bug, etc.)
Every contribution, no matter how small, helps improve the project for everyone! 🎉
gryfoss/int-combiner 适用场景与选型建议
gryfoss/int-combiner 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 96 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 09 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 gryfoss/int-combiner 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gryfoss/int-combiner 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 96
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-17