### Install from source with make install Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Clones the repository and runs make install to install the tool. Requires Git and Make. If permission denied errors occur, use sudo make install instead. ```bash git clone https://github.com/zoliszabo/php-compat-check.git cd php-compat-check make install ``` -------------------------------- ### Install from source with sudo make install Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Alternative to make install when permission denied errors occur. Uses sudo to gain elevated privileges for the installation. ```bash sudo make install ``` -------------------------------- ### Customize installation directory with INSTALL_DIR Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Installs the tool to a custom directory by passing INSTALL_DIR to make install. Replace the path with your desired installation location. ```bash make install INSTALL_DIR="$HOME/.local/bin" ``` -------------------------------- ### Manual installation from source Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Manually installs the VERSION and HELP files to /usr/local/share/php-compat-check/ and copies the executable to /usr/local/bin. Requires appropriate permissions for /usr/local directories. ```bash install -D -m 644 VERSION /usr/local/share/php-compat-check/VERSION install -D -m 644 HELP /usr/local/share/php-compat-check/HELP cp bin/php-compat-check /usr/local/bin/php-compat-check chmod +x /usr/local/bin/php-compat-check ``` -------------------------------- ### Download and install latest release archive Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Downloads the latest stable release archive, extracts it, and installs the executable and supporting files to ~/.local. Requires Docker to be installed and running for compatibility checks. The export line adds ~/.local/bin to PATH; add it to your shell startup file if not already present. ```bash curl -fL -o php-compat-check-latest.tar.gz \ https://github.com/zoliszabo/php-compat-check/releases/latest/download/php-compat-check-latest.tar.gz tar -xzf php-compat-check-latest.tar.gz cd php-compat-check-latest mkdir -p "$HOME/.local" cp -R bin share "$HOME/.local/" export PATH="$HOME/.local/bin:$PATH" php-compat-check --version php-compat-check --help ``` -------------------------------- ### Find minimum, starting from a specific version Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Finds the minimum compatible PHP version for sebastian/diff, starting the search from PHP 7.4. ```bash php-compat-check sebastian/diff --min-php-version --from-php-version=7.4 ``` -------------------------------- ### Find minimum supported version Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Finds the minimum compatible PHP version for sebastian/diff. ```bash php-compat-check sebastian/diff --min-php-version ``` -------------------------------- ### Show dependency table Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Checks sebastian/diff against PHP 8.1 with dependency checking and prints the installed production dependencies and their scan status. ```bash php-compat-check sebastian/diff 8.1 --check-deps --show-deps ``` -------------------------------- ### Uninstall with make uninstall Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Removes the installed tool using the Makefile's uninstall target. ```bash make uninstall ``` -------------------------------- ### Existing package and repository commands Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Commands for checking Git repositories, Packagist packages, and specifying version constraints or source versions. ```bash php-compat-check https://github.com/vendor/package 8.1 ``` ```bash php-compat-check vendor/package 8.1 ``` ```bash php-compat-check vendor/package:^6.0 8.1 ``` ```bash php-compat-check vendor/package:dev-main 8.1 ``` ```bash php-compat-check https://github.com/vendor/package 8.1 --source-version=v6.0.2 ``` -------------------------------- ### Build and run the Docker image locally with make Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Builds the image locally and runs it against a package. `make run` always rebuilds the image before running, so you never test stale code. ```bash # Build the image locally make build # Run against a package (rebuilds automatically) make run ARGS="sebastian/diff 8.1" make run ARGS="sebastian/diff --min-php-version" make run ARGS="sebastian/diff 8.1 --check-deps" make run ARGS=". 8.1" ``` -------------------------------- ### Find minimum supported PHP version Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Scans known versions that satisfy the require.php constraint, starting at PHP 5.6 unless a lower bound is supplied. Use --from-php-version and --to-php-version to bound the search. ```bash php-compat-check --min-php-version ``` -------------------------------- ### Check against a specific version Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Runs a compatibility check for the sebastian/diff package against PHP 8.1. ```bash php-compat-check sebastian/diff 8.1 ``` -------------------------------- ### Run php-compat-check with Docker mounting local project Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Mounts the current directory read-only into the container and passes the container path as the source. Use local:/project to check the mounted project. ```bash docker run --rm -v "$PWD:/project:ro" zoliszabo/php-compat-check php-compat-check local:/project 8.1 ``` -------------------------------- ### Include dependencies (full — scan everything) Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Checks sebastian/diff against PHP 8.1 and includes production dependencies in full mode, scanning everything. ```bash php-compat-check sebastian/diff 8.1 --check-deps=full ``` -------------------------------- ### Check a specific release Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Checks the sebastian/diff package version ^6.0 against PHP 8.1. ```bash php-compat-check sebastian/diff:^6.0 8.1 ``` -------------------------------- ### Run php-compat-check with Docker directly Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Runs the tool in a Docker container using the zoliszabo/php-compat-check image. Replace and with your source path and target PHP version. ```bash docker run --rm zoliszabo/php-compat-check php-compat-check ``` -------------------------------- ### Check a local project Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Commands for checking local directories, including current directory, relative/absolute paths, and finding the minimum PHP version. Local projects are mounted read-only and never modified. ```bash # Current directory php-compat-check . 8.1 ``` ```bash # Relative or absolute directory (quote paths containing spaces) php-compat-check ../my-project 8.1 php-compat-check "local:/path/to/my project" 8.1 ``` ```bash # Find the minimum version using the current working files php-compat-check . --min-php-version ``` ```bash # Include dependencies already installed in vendor/ php-compat-check . 8.1 --check-deps=full --show-deps ``` -------------------------------- ### Scan dependencies with --check-deps Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md For remote sources, installs non-dev Composer dependencies and includes them in the scan. For local sources, checks already-installed production dependencies without running Composer install. The optional mode can be shallow (default) or full; shallow trusts packages with a compatible require.php, while full scans all vendor packages. ```bash php-compat-check --check-deps ``` -------------------------------- ### Run make release Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Runs the release process from a clean checkout on a remote branch. Requires Git, Make, authenticated GitHub CLI, and prerequisites for make test. Executes regression tests, commits VERSION, creates annotated tag, pushes, and creates a draft GitHub Release. ```bash make release ``` -------------------------------- ### Run integration tests with make test-integration Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Builds the current image and runs fixture tests using Python 3, Bash, and Docker. The tests cover actual PHP syntax compatibility, minimum-version detection, shallow/full dependency scans, development dependency exclusion, missing dependencies, and local paths with spaces. ```bash make test-integration ``` -------------------------------- ### Reuse an already built image for integration tests Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Runs integration tests using an image already built from the current source, bypassing automatic rebuilds. ```bash PHP_COMPAT_CHECK_IMAGE=php-compat-check:dev python3 -m unittest discover -s tests/integration -v ``` -------------------------------- ### Scan specific directories Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Checks sebastian/diff against PHP 8.1 and scans only the src and lib directories. ```bash php-compat-check sebastian/diff 8.1 --scan-dirs=src,lib ``` -------------------------------- ### Check the dev-main branch Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Checks the sebastian/diff package's dev-main branch against PHP 8.1. ```bash php-compat-check sebastian/diff:dev-main 8.1 ``` -------------------------------- ### Dependency scan modes: shallow and full Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Shallow scan trusts packages that declare a require.php compatible with the target; full scan checks every vendor package regardless of declared PHP constraint. For remote sources, packages with incompatible require.php are always excluded; for local sources, incompatible installed dependencies are reported as errors. ```bash # Shallow scan — trust packages that declare compatibility php-compat-check vendor/package 8.1 --check-deps ``` ```bash # Equivalent explicit form php-compat-check vendor/package 8.1 --check-deps=shallow ``` ```bash # Full scan — check every vendor package php-compat-check vendor/package 8.1 --check-deps=full ``` -------------------------------- ### Basic compatibility check command Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Run a compatibility check against a specific PHP version. The source argument is resolved automatically or can have an explicit prefix. ```bash php-compat-check ``` -------------------------------- ### Run CLI regression tests with unittest Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Runs CLI regression tests. Requires Python 3, Bash, PHP, jq, and a Composer PHAR on PATH. The tests stub Docker, network access, and PHP_CodeSniffer while using real PHP and Composer semver. ```bash python3 -m unittest discover -s tests -v ``` -------------------------------- ### Include dependencies (shallow — trust declared constraints) Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Checks sebastian/diff against PHP 8.1 and includes production dependencies using the default shallow mode, which trusts declared constraints. ```bash php-compat-check sebastian/diff 8.1 --check-deps ``` -------------------------------- ### Override release version, next version, or remote Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Overrides the release version, next development version, or remote for make release. When RELEASE_VERSION is omitted, the command prompts on stdin; set it explicitly to skip the prompt in unattended runs. ```bash make release RELEASE_VERSION=3.3.0 NEXT_VERSION=3.4.0-dev ``` ```bash make release RELEASE_REMOTE=upstream ``` -------------------------------- ### Find highest compatible PHP version with --max-php-version Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Checks known PHP versions from newest to oldest and stops at the first passing version. Accepts optional bounds via --from-php-version and --to-php-version, and --check-deps=full to scan all vendor packages. Reversed bounds, conflicting search modes, or combining a target version with a search are rejected. ```bash php-compat-check . --max-php-version ``` ```bash php-compat-check . --max-php-version --from-php-version=8.0 --to-php-version=8.4 ``` ```bash php-compat-check . --max-php-version --check-deps=full ``` -------------------------------- ### Generate compatibility matrix with --matrix Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Checks every known PHP version in the bounded range independently and prints PASS, FAIL, or EXCLUDED for each. Composer exclusions are shown explicitly and are not counted as checked versions; use --ignore-composer-php-version to scan them too. A matrix succeeds when at least one version was checked and every checked version passes. ```bash php-compat-check . --matrix --from-php-version=8.0 --to-php-version=8.5 ``` ```bash php-compat-check . --matrix --check-deps=full ``` -------------------------------- ### Generate JSON report with php-compat-check Source: https://github.com/zoliszabo/php-compat-check/blob/main/README.md Use --format=json to write a single JSON document to stdout while progress and diagnostics go to stderr. Supports checks, both searches, and matrices. Exit codes retain their meaning even when a valid JSON report describes incompatibility or an analysis error. ```bash php-compat-check . 8.1 --format=json ``` ```bash php-compat-check . --max-php-version --check-deps=full --format=json ``` ```bash php-compat-check . --matrix --from-php-version=8.0 --format=json > compatibility.json ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.