Development
Setup
git clone https://github.com/ducks-project/encoding-repair.git
cd encoding-repair
composer install
Verify Installation
php -v # Check PHP version (>= 7.4)
php -m | grep mbstring # Verify mbstring
php -m | grep json # Verify json
php -m | grep intl # Check intl (optional)
Running Tests
# Run all tests
composer test
# Run unit tests with coverage
composer unittest
# Run benchmarks
composer bench
# Run specific test
./vendor/bin/phpunit tests/phpunit/CharsetHelperTest.php
Code Quality
# Static analysis
composer phpstan
# Type checking
composer psalm
# Check code style
composer phpcsfixer-check
# Fix code style
./vendor/bin/php-cs-fixer fix
# Run all quality checks
composer phpstan && composer psalm && composer phpcsfixer-check
Full CI Pipeline
# Run all CI checks locally
composer ci
Project Structure
encoding-repair/
├── CharsetHelper.php # Main library class
├── tests/
│ ├── phpunit/ # Unit tests
│ └── benchmark/ # Performance benchmarks
├── docs/ # Documentation
├── composer.json # Dependencies
└── .github/workflows/ # CI/CD
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature)
- Write tests for your changes
- Ensure tests pass (
composer test)
- Run static analysis (
composer phpstan)
- Fix code style (
composer phpcsfixer-check)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
Next Steps