Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Phar::addFromStringPhar::buildFromDirectory>
^PharLast updated: Mon, 26 Oct 2026

Phar::apiVersion

(PHP 5 >= 5.3.0, PHP 7, PHP 8, PECL phar >= 1.0.0)

Phar::apiVersion — Returns the api version

Description

final public static function Phar::apiVersion(): string

Return the API version of the phar file format that will be used when creating phars. The Phar extension supports reading API version 1.0.0 or newer. API version 1.1.0 is required for SHA-256 and SHA-512 hash, and API version 1.1.1 is required to store empty directories.

Parameters

Return Values

The API version string as in "1.0.0".

Examples

Example #1 A Phar::apiVersion() example

<?php
echo Phar::apiVersion();
?>

The above example will output:

1.1.1


<Phar::addFromStringPhar::buildFromDirectory>
^PharLast updated: Mon, 26 Oct 2026