Skip to content

Contributing to phpmlkit/opal

Requirements

  • PHP 8.2+
  • ext-ffi

Setup

bash
composer install

This downloads the correct libvips binary for your platform into lib/.

Development Commands

CommandDescription
composer testRun all tests
composer test:prettyRun tests with testdox output
composer test:coverageRun tests with coverage report
composer cs:fixAuto-fix code style
composer cs:checkCheck code style (dry-run)
composer lintRun PHPStan analysis

Coding Standards

  • Follow PSR-12 and @PhpCsFixer rules — run composer cs:fix before committing.
  • Declare strict_types=1 in every file.
  • All new public API must be fully typed (PHP 8.2+ type system).
  • All new methods must include PHPDoc with parameter and return types.
  • Immutable operations: transformations return new instances, never mutate $this.

Tests

  • Tests live in tests/ and use PHPUnit 10.
  • Name test methods with test prefix or use the #[Test] attribute.
  • Run composer test to verify nothing is broken.

Pull Requests

  1. Ensure all tests pass and code style is clean.
  2. Run composer lint (PHPStan level 8) — no new errors.
  3. Add tests for any new functionality.
  4. Keep commits small and use conventional commits.

Released under the MIT License.