| title | Contributing |
|---|---|
| description | Guidelines for contributing to DJson |
Thank you for your interest in contributing to DJson! We welcome contributions from the community.
- Fork the repository
- Clone your fork:
git clone https://github.com/your-username/djson.git - Install dependencies:
composer install - Run tests:
vendor/bin/phpunit
# Run all tests
vendor/bin/phpunit
# Run with coverage
vendor/bin/phpunit --coverage-html coverage
# Run mutation testing
vendor/bin/infection- PHP 8.1+ features (constructor property promotion, enums, etc.)
- Strict types declared in all files
- PSR-4 autoloading
- Comprehensive test coverage
- Create a new branch:
git checkout -b feature/your-feature-name - Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Commit your changes with clear messages
- Push to your fork
- Open a Pull Request
- Title: Clear and descriptive
- Description: Explain what changes you made and why
- Tests: Include tests for new features or bug fixes
- Documentation: Update docs if needed
- One feature per PR: Keep PRs focused
Follow existing code style in the project:
<?php
declare(strict_types=1);
namespace Qoliber\DJson;
/**
* Example class demonstrating DJson code style
*/
class Example
{
/**
* @param string $value The value to process
*/
public function __construct(
private string $value
) {}
/**
* Process the value by converting to uppercase
*
* @return string The processed uppercase value
*/
public function process(): string
{
return strtoupper($this->value);
}
}When adding a new directive:
- Create a class implementing
DirectiveInterface - Add tests in
tests/ - Document in
docs/api/directives.md - Add example usage
When adding a new function:
- Register in
FunctionProcessor::registerBuiltInFunctions() - Add tests
- Document in
docs/api/functions.md - Add real-world examples
We maintain high test coverage:
- 103 tests with 385 assertions
- Mutation testing with Infection
- All new code must include tests
Update documentation when:
- Adding new features
- Changing existing behavior
- Adding examples
- Fixing bugs that affect usage
Documentation is in the docs/ directory using VitePress.
When reporting bugs:
- Check if the issue already exists
- Provide a clear description
- Include code examples
- Specify PHP version
- Include error messages
- Open a GitHub Discussion
- Check existing Issues
By contributing, you agree that your contributions will be licensed under the MIT License.