How to Contribute

Canvas Framework is an open-source PHP framework. This guide covers contribution essentials. Requirements: PHP 8.2+ and Composer.

Quick Start

# Fork https://github.com/quellabs/canvas on GitHub
git clone https://github.com/YOUR-USERNAME/canvas.git
cd canvas
composer install

Contribution Workflow

# Create feature branch
git checkout -b feature/your-feature-name

# Make changes, write tests, update docs

# Run tests and style checks
./vendor/bin/pest
./vendor/bin/php-cs-fixer fix

# Commit and push
git add .
git commit -m "feat: your feature description"
git push origin feature/your-feature-name

# Open PR at https://github.com/quellabs/canvas/pulls

Code Style

Canvas follows PSR-12 with modifications: tabs (not spaces), opening braces on same line, strict types always declared.

<?php

declare(strict_types=1);

namespace Quellabs\Canvas\Example;

class ExampleController {

	protected string $config;

	public function __construct(string $config) {
		$this->config = $config;
	}

	public function getUsers(int $limit = 10): JsonResponse {
		if ($limit <= 0) {
			return $this->json(['error' => 'Invalid limit'], 400);
		}

		$users = $this->em()->findBy(User::class, [
			'active' => true,
			'deleted_at' => null,
		]);

		return $this->json(['data' => array_slice($users, 0, $limit)]);
	}
}

Style enforcement: Run ./vendor/bin/php-cs-fixer fix before committing.

Testing

Canvas uses Pest. All contributions require tests with 90%+ coverage for new features.

<?php

// tests/Unit/UserServiceTest.php

it('creates user with valid data', function () {
	$service = new UserService();
	$user = $service->create(['email' => 'test@example.com']);

	expect($user->email)->toBe('test@example.com');
});

it('throws exception for invalid email', function () {
	$service = new UserService();

	expect(fn() => $service->create(['email' => 'invalid']))
		->toThrow(InvalidArgumentException::class);
});
# Run tests
./vendor/bin/pest

# With coverage
./vendor/bin/pest --coverage --min=80

Reporting Issues

Report bugs at github.com/quellabs/canvas/issues

Include: Expected vs actual behavior, reproduction steps, environment (Canvas version, PHP version, OS), error messages.

Code Review

Contributors: Respond to feedback within 1 week, make changes in new commits, request re-review when ready.

Reviewers: Check style compliance, test coverage, documentation updates, backwards compatibility.

Community

  • GitHub Issues: Bug reports and feature requests
  • GitHub Discussions: Questions and ideas
  • Stack Overflow: Tag with canvas-framework

Guidelines: Be respectful, provide constructive feedback, welcome newcomers, assume good intentions.

Release Process

Canvas follows Semantic Versioning:

  • MAJOR: Breaking changes
  • MINOR: New features (backwards compatible)
  • PATCH: Bug fixes

Branches: main (stable), develop (next release), feature/*, hotfix/*