Chilkat2 PHP
============

Chilkat2 PHP is the PHP-style Chilkat API: the extension "chilkat2", classes in the Chilkat2 namespace
(Chilkat2\Http, Chilkat2\JsonObject, ...), real PHP properties ($http->ConnectTimeout = 10), exceptions
(Chilkat2\Exception) instead of status codes, and closures for progress callbacks.  It is independent of the
classic Chilkat PHP extension (extension=chilkat, include "chilkat.php", CkHttp, ...); the two can be installed
side by side.

Requirements: PHP 8.1 or later.  Each archive is built for ONE PHP minor version (8.1, 8.2, ...), for
non-thread-safe (NTS) or thread-safe (ZTS) PHP, and for one OS and architecture.  Pick the archive that
matches the PHP you run:

  php -r 'echo PHP_VERSION, PHP_ZTS ? " ZTS" : " NTS", " ", php_uname("m"), "\n";'

The archive names say which is which: chilkat2-php-<version>-... is NTS (the usual PHP CLI, PHP-FPM and
mod_php builds of Linux distributions and Homebrew), chilkat2-php-zts-<version>-... is ZTS.


What is in this archive
-----------------------

  chilkat2.so          the extension (code-signed on macOS)
  chilkat2.stub.php    the classes with types and PHPDoc, for your IDE and static analysis.  Never include it:
                       the extension defines the classes.
  test.php             a quick check that everything loads
  license / SBOM files


Install
-------

1. Copy chilkat2.so into PHP's extension directory:

     php -r 'echo ini_get("extension_dir"), "\n";'

2. Enable it in php.ini, or in a file of its own in the conf.d directory that "php --ini" lists
   (for example 20-chilkat2.ini):

     extension=chilkat2

3. Check:

     php -m | grep chilkat2
     php test.php

To try it without installing anything:

     php -d extension=./chilkat2.so test.php

Web servers (PHP-FPM, Apache mod_php) read their own php.ini: enable the extension there too and restart
the service.  phpinfo() shows a "chilkat2" section with the Chilkat version when the extension is loaded.


Using it
--------

  <?php
  use Chilkat2\Http;

  try {
      $http = new Http(['ConnectTimeout' => 10]);
      $http->onPercentDone(function (int $pct): bool { echo "$pct%\n"; return false; });
      $html = $http->QuickGetStr('https://www.chilkatsoft.com/');
  } catch (\Chilkat2\Exception $e) {
      echo $e->getMessage();          // the object's LastErrorText
  }

A failed call throws Chilkat2\Exception.  To use return values instead (false / null on failure, the reason
in $obj->LastErrorText), create the object with ['RaiseError' => false].

Unlocking: call (new Chilkat2\GlobalSettings())->UnlockBundle('<your unlock code>') once at startup.  Without
a purchased unlock code Chilkat runs as a 30-day trial.

Documentation and examples: https://www.chilkatsoft.com/
