Thank you for your interest in contributing to fetch-php! We welcome contributions from the community and are pleased to have you join us.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Pull Request Process
- Coding Standards
- Testing
- Documentation
- Issue Reporting
- Security Issues
- Community
By participating in this project, you are expected to uphold our Code of Conduct.
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/Thavarshan/fetch-php.git cd fetch-php -
Add the upstream repository:
git remote add upstream https://github.com/Thavarshan/fetch-php.git
- PHP 8.3 or higher
- Composer
- Git
-
Install dependencies:
composer install
-
Run the test suite to ensure everything is working:
composer test -
Run the linter:
composer lint
composer test- Run PHPUnit testscomposer lint- Run coding standards checkscomposer fix- Fix coding standard violations automatically
We welcome several types of contributions:
- Bug reports - Help us identify and fix issues
- Feature requests - Suggest new functionality
- Code contributions - Submit bug fixes or new features
- Documentation - Improve or add documentation
- Testing - Add test coverage or improve existing tests
- Check existing issues and pull requests
- For large changes, create an issue first to discuss the approach
- Make sure you understand the library's architecture and goals
Create a feature branch from main:
git checkout main
git pull upstream main
git checkout -b feature/your-feature-nameUse descriptive branch names:
feature/add-retry-mechanismfix/handle-connection-timeoutdocs/improve-readme
- Write clear, readable code
- Follow the existing code style
- Add tests for new functionality
- Update documentation as needed
Run the full test suite:
composer test
composer lintMake sure all tests pass and there are no linting errors.
Write clear, descriptive commit messages:
git add .
git commit -m "feat: add retry mechanism for failed requests
- Add configurable retry attempts
- Implement exponential backoff
- Add tests for retry functionality"We follow Conventional Commits:
feat:for new featuresfix:for bug fixesdocs:for documentation changestest:for adding testsrefactor:for code refactoringperf:for performance improvements
git push origin feature/your-feature-nameCreate a pull request through GitHub's interface.
Your pull request should:
- Have a clear title and description
- Reference any related issues
- Include tests for new functionality
- Pass all CI checks
- Follow coding standards
- Update documentation if needed
- Be reviewed and approved by maintainers
We follow PSR-12 coding standards with some additional rules:
- Use Laravel Pint for code formatting
- Follow PSR-4 autoloading standards
- Use strict typing (
declare(strict_types=1);) - Use meaningful variable and method names
- Write PHPDoc comments for public methods
<?php
declare(strict_types=1);
namespace Fetch\Http;
/**
* Handles HTTP request configuration and execution.
*/
final class Request
{
/**
* Set the request timeout.
*/
public function timeout(int $seconds): self
{
// Implementation
}
}We use PHPUnit for testing. All contributions should include appropriate tests.
- Unit tests go in
tests/Unit/ - Integration tests go in
tests/Integration/ - Use descriptive test method names
- Test both success and failure scenarios
- Mock external dependencies
<?php
declare(strict_types=1);
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
final class RequestTest extends TestCase
{
public function test_it_can_set_timeout(): void
{
$request = new Request();
$result = $request->timeout(30);
$this->assertInstanceOf(Request::class, $result);
$this->assertEquals(30, $result->getTimeout());
}
}- All public methods must have PHPDoc comments
- Include parameter types and return types
- Describe what the method does and any side effects
- Include
@throwsannotations for exceptions
- Update README.md for new features
- Add examples for new functionality
- Update the changelog for significant changes
- Consider adding documentation to the docs/ folder
When reporting bugs, please include:
- Library version
- PHP version
- Operating system
- Minimal code example
- Expected vs actual behavior
- Error messages/stack traces
For feature requests, describe:
- The problem you're trying to solve
- Your proposed solution
- Alternative approaches considered
- Example usage
DO NOT report security vulnerabilities in public issues.
Instead, please email security concerns to: tjthavarshan@gmail.com
We take security seriously and will respond promptly to security reports.
- Join discussions in GitHub Discussions
- Follow the project for updates
- Help others by answering questions
- Share your use cases and feedback
Contributors will be recognized in:
- The project's README
- Release notes for significant contributions
- The project's contributors page
If you have questions about contributing, please:
- Check this document first
- Look at existing issues and discussions
- Create a new discussion topic
- Reach out to maintainers
Thank you for contributing to fetch-php! 🚀