Thank you for your interest in contributing to the Skald PHP SDK! This document provides guidelines for contributing to the project.
- Fork the repository
- Clone your fork locally
- Install dependencies:
composer install - Create a new branch for your feature:
git checkout -b feature/my-new-feature
- PHP 8.1 or higher
- Composer
- A Skald API key for testing
composer installFor running tests, set your API key:
export SKALD_API_KEY=sk_proj_your_api_keyThis project follows strict code quality standards:
All code must adhere to PSR-12 coding standards.
Check code style:
composer cs-checkFix code style automatically:
composer cs-fixWe use PHPStan at level 8 for static analysis.
Run static analysis:
composer phpstan- Use strict types (
declare(strict_types=1);) in all PHP files - Use type hints for all parameters and return types
- Use readonly properties where appropriate
- Leverage PHP 8.1+ features (enums, union types, etc.)
Run all tests:
composer testRun specific test file:
vendor/bin/phpunit tests/SkaldTest.phpRun with coverage:
vendor/bin/phpunit --coverage-html coverage- Write tests for all new features
- Maintain or improve code coverage
- Use descriptive test method names
- Include both unit tests and integration tests
- Mock external dependencies where appropriate
Test file naming:
- Unit tests:
tests/ClassName/MethodTest.php - Integration tests:
tests/ClassNameTest.php
Follow conventional commit format:
type(scope): subject
body
footer
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Example:
feat(search): add support for custom result ordering
Added optional 'orderBy' parameter to SearchRequest to allow
sorting results by different fields.
Closes #123
- Update documentation for any API changes
- Add/update tests for your changes
- Ensure all tests pass
- Ensure code style checks pass
- Update CHANGELOG.md with your changes
- Create a pull request with a clear description
- Tests added/updated
- Documentation updated
- Code style checks pass
- Static analysis passes
- CHANGELOG.md updated
- No breaking changes (or clearly documented)
- Add PHPDoc comments to all classes, methods, and properties
- Include
@paramand@returntags - Add usage examples in doc blocks for complex methods
- Keep documentation up to date with code changes
Update README.md when:
- Adding new features
- Changing public APIs
- Adding new examples
- Updating requirements
When adding new features:
- Add example usage to the
examples/directory - Update
examples/README.mdwith the new example - Ensure examples run without errors
We use Semantic Versioning:
- MAJOR: Incompatible API changes
- MINOR: Backwards-compatible new features
- PATCH: Backwards-compatible bug fixes
Include:
- PHP version
- Skald SDK version
- Steps to reproduce
- Expected behavior
- Actual behavior
- Error messages/stack traces
Include:
- Use case description
- Proposed solution
- Alternative solutions considered
- Willingness to contribute
By contributing, you agree that your contributions will be licensed under the MIT License.