---
product: Chilkat
product_version: 11.7.0
language: php2
language_label: Chilkat2 PHP
document: language guide
---
> Chilkat 11.7.0 · language=php2 · this file: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/php2/guide.md`
> Class pages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/php2/classes/<Class>.md`

# Chilkat for Chilkat2 PHP — language guide — v11.7.0

> This guide has only generated sections so far. The class pages carry the per-member detail.

## Object creation, unlocking and error handling

**Object Creation**

```php
use Chilkat2\GlobalSettings;

try {
    $glob = new GlobalSettings();
    // ... use $glob ...
} catch (\Chilkat2\Exception $e) {
    echo $e->getClass(), '::', $e->getMethod(), " failed\n";
    echo $e->getMessage(), "\n";              // the LastErrorText of the failed call
}
```

`public function __construct(array $properties = [])`

Creates the object. The optional array sets properties in order, as if assigned one by one (`new GlobalSettings(['VerboseLogging' => true, 'RaiseError' => false])`); an unknown or read-only name throws `Error`. The class is defined by the `chilkat2` extension (`extension=chilkat2` in `php.ini`): there is no PHP file to include.

There is no `close()`: PHP frees the object when its last reference goes (`unset($glob)`, `$glob = null`, or the end of the function or request). Objects returned by methods are independent and freed the same way. The class may be extended (`class MyGlobalSettings extends \Chilkat2\GlobalSettings`); objects cannot be cloned or serialized.

`public bool $RaiseError;`

When `true` (the default), a method that fails throws `Chilkat2\Exception`. When `false`, it returns `false` (or `null`) instead, and the reason is in `LastErrorText`. Objects returned by a method inherit the value of the object that returned them.

**Errors**

`Chilkat2\Exception` extends `RuntimeException`: `getMessage()` is the failed call's full `LastErrorText`, `getClass()` its class (`'Chilkat2\GlobalSettings'`) and `getMethod()` the method name. The object remains usable. Methods that look something up and find nothing return `null` without throwing (each such method says so), methods that answer a question (`HasMember`, `IsUnlocked`, ...) return a plain `bool`, and property reads and writes do not throw for Chilkat reasons.

Misuse always throws, whatever `RaiseError` is: a wrong argument type is a `TypeError` (exact types under `declare(strict_types=1)`), a missing or extra argument an `ArgumentCountError`, a string containing a NUL byte or an out-of-range integer a `ValueError`, and an unknown property (properties are case-sensitive) or a write to a read-only one an `Error`. Named arguments work with the parameter names shown.

Strings are passed and returned as UTF-8; binary data is a PHP string of bytes. Unlocking: call `(new \Chilkat2\GlobalSettings())->UnlockBundle('...')` once at startup.

Literals in Chilkat2 PHP: true is `true`, false is `false`, null/none is `null`.

## Classes

[Class index for Chilkat2 PHP](https://www.chilkatsoft.com/ai-docs/v/11.7.0/php2/index.md)
