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
thread-safe (TS) or non-thread-safe (NTS) PHP, and for 32-bit (win32) or 64-bit (x64) PHP.  Pick the archive
that matches the PHP you run:

  php -r "echo PHP_VERSION, PHP_ZTS ? ' TS' : ' NTS', ' ', PHP_INT_SIZE * 8, '-bit', PHP_EOL;"

The archive names say which is which: chilkat2-php-<version>-nts-<x64|win32> is NTS (the build used with
IIS/FastCGI and most command-line installs), chilkat2-php-<version>-<x64|win32> is thread-safe (Apache
mod_php).  php.exe -i | findstr "Thread" also tells.


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

  php_chilkat2.dll     the extension (code-signed)
  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 php_chilkat2.dll into PHP's extension directory (usually the "ext" folder under the PHP folder):

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

2. Enable it in php.ini ("php --ini" shows which php.ini is loaded):

     extension=chilkat2

3. Check:

     php -m | findstr chilkat2
     php test.php

To try it without installing anything:

     php -d extension=.\php_chilkat2.dll test.php

The DLL is linked statically with the Visual C++ runtime: no redistributable is needed.  Web servers read
their own php.ini: enable the extension there too and restart the server or the FastCGI pool.  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/
