Canvas Framework is an open-source PHP framework. This guide covers contribution essentials. Requirements: PHP 8.2+ and Composer.
# Fork https://github.com/quellabs/canvas on GitHub
git clone https://github.com/YOUR-USERNAME/canvas.git
cd canvas
composer install
# 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
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.
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
Report bugs at github.com/quellabs/canvas/issues
Include: Expected vs actual behavior, reproduction steps, environment (Canvas version, PHP version, OS), error messages.
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.
canvas-frameworkGuidelines: Be respectful, provide constructive feedback, welcome newcomers, assume good intentions.
Canvas follows Semantic Versioning:
Branches: main (stable), develop (next release), feature/*, hotfix/*