Oihana PHP

assertPhar.php

Table of Contents

Functions

assertPhar()  : void
Ensures that the `PharData` class and `phar` extension are available in the PHP environment.

Functions

assertPhar()

Ensures that the `PharData` class and `phar` extension are available in the PHP environment.

assertPhar() : void

This function is typically used as a safeguard before attempting to work with .phar, .tar, .tar.gz, or .zip files using the PharData class.

Tags
throws
RuntimeException

If the PharData class does not exist or the phar extension is not enabled.

example
use function oihana\files\phar\assertPhar;

try
{
    assertPhar();
    $phar = new \PharData('/path/to/archive.tar');
    // proceed with Phar operations...
}
catch (\RuntimeException $e)
{
    echo "Phar support is not available: " . $e->getMessage();
}
author

Marc Alcaraz (ekameleon)

since
1.0.0

        
On this page

Search results