From c564c3ffb9107fd7d28b583d073eaf224ac13caf Mon Sep 17 00:00:00 2001 From: Adiel Cristo Date: Fri, 29 Aug 2025 07:46:40 -0300 Subject: [PATCH] fix: minor docs fixes --- docs/compile.md | 4 ++-- docs/config.md | 5 ++--- docs/extensions.md | 34 +++++++++++++++++----------------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/docs/compile.md b/docs/compile.md index 76dc2cc4..a8df40f9 100644 --- a/docs/compile.md +++ b/docs/compile.md @@ -25,8 +25,8 @@ brew link --overwrite --force shivammathur/php/php-zts ### By Compiling PHP Alternatively, you can compile PHP from sources with the options needed by FrankenPHP by following these steps. -~~ -~~First, [get the PHP sources](https://www.php.net/downloads.php) and extract them: + +First, [get the PHP sources](https://www.php.net/downloads.php) and extract them: ```console tar xf php-* diff --git a/docs/config.md b/docs/config.md index 70525c9b..64654a18 100644 --- a/docs/config.md +++ b/docs/config.md @@ -8,7 +8,7 @@ You can specify a custom path with the `-c` or `--config` option. PHP itself can be configured [using a `php.ini` file](https://www.php.net/manual/en/configuration.file.php). -Depending on your installation method, the PHP interpreter will look for configuration files in locations described above. +Depending on your installation method, the PHP interpreter will look for configuration files in locations described below. ## Docker @@ -55,8 +55,7 @@ localhost { } ``` -You can also explicitly configure FrankenPHP using the global option: -The `frankenphp` [global option](https://caddyserver.com/docs/caddyfile/concepts#global-options) can be used to configure FrankenPHP. +You can also explicitly configure FrankenPHP using the [global option](https://caddyserver.com/docs/caddyfile/concepts#global-options) `frankenphp`: ```caddyfile { diff --git a/docs/extensions.md b/docs/extensions.md index c87b627b..562875ca 100644 --- a/docs/extensions.md +++ b/docs/extensions.md @@ -81,19 +81,19 @@ While the first point speaks for itself, the second may be harder to apprehend. While some variable types have the same memory representation between C/PHP and Go, some types require more logic to be directly used. This is maybe the hardest part when it comes to writing extensions because it requires understanding internals of the Zend Engine and how variables are stored internally in PHP. This table summarizes what you need to know: -| PHP type | Go type | Direct conversion | C to Go helper | Go to C helper | Class Methods Support | -|--------------------|-------------------------------|-------------------|---------------------------------|----------------------------------|-----------------------| -| `int` | `int64` | ✅ | - | - | ✅ | -| `?int` | `*int64` | ✅ | - | - | ✅ | -| `float` | `float64` | ✅ | - | - | ✅ | -| `?float` | `*float64` | ✅ | - | - | ✅ | -| `bool` | `bool` | ✅ | - | - | ✅ | -| `?bool` | `*bool` | ✅ | - | - | ✅ | -| `string`/`?string` | `*C.zend_string` | ❌ | frankenphp.GoString() | frankenphp.PHPString() | ✅ | -| `array` | `frankenphp.AssociativeArray` | ❌ | frankenphp.GoAssociativeArray() | frankenphp.PHPAssociativeArray() | ✅ | -| `array` | `map[string]any` | ❌ | frankenphp.GoMap() | frankenphp.PHPMap() | ✅ | -| `array` | `[]any` | ❌ | frankenphp.GoPackedArray() | frankenphp.PHPPackedArray() | ✅ | -| `object` | `struct` | ❌ | _Not yet implemented_ | _Not yet implemented_ | ❌ | +| PHP type | Go type | Direct conversion | C to Go helper | Go to C helper | Class Methods Support | +|--------------------|-------------------------------|-------------------|-----------------------------------|------------------------------------|-----------------------| +| `int` | `int64` | ✅ | - | - | ✅ | +| `?int` | `*int64` | ✅ | - | - | ✅ | +| `float` | `float64` | ✅ | - | - | ✅ | +| `?float` | `*float64` | ✅ | - | - | ✅ | +| `bool` | `bool` | ✅ | - | - | ✅ | +| `?bool` | `*bool` | ✅ | - | - | ✅ | +| `string`/`?string` | `*C.zend_string` | ❌ | `frankenphp.GoString()` | `frankenphp.PHPString()` | ✅ | +| `array` | `frankenphp.AssociativeArray` | ❌ | `frankenphp.GoAssociativeArray()` | `frankenphp.PHPAssociativeArray()` | ✅ | +| `array` | `map[string]any` | ❌ | `frankenphp.GoMap()` | `frankenphp.PHPMap()` | ✅ | +| `array` | `[]any` | ❌ | `frankenphp.GoPackedArray()` | `frankenphp.PHPPackedArray()` | ✅ | +| `object` | `struct` | ❌ | _Not yet implemented_ | _Not yet implemented_ | ❌ | > [!NOTE] > This table is not exhaustive yet and will be completed as the FrankenPHP types API gets more complete. @@ -125,7 +125,7 @@ func process_data_ordered_map(arr *C.zval) unsafe.Pointer { } // return an ordered array - // if 'Order' is not empty, only the key-value paris in 'Order' will be respected + // if 'Order' is not empty, only the key-value pairs in 'Order' will be respected return frankenphp.PHPAssociativeArray(AssociativeArray{ Map: map[string]any{ "key1": "value1", @@ -181,9 +181,9 @@ func process_data_packed(arr *C.zval) unsafe.Pointer { * `frankenphp.PHPAssociativeArray(arr frankenphp.AssociativeArray) unsafe.Pointer` - Convert to an ordered PHP array with key-value pairs * `frankenphp.PHPMap(arr map[string]any) unsafe.Pointer` - Convert a map to an unordered PHP array with key-value pairs * `frankenphp.PHPPackedArray(slice []any) unsafe.Pointer` - Convert a slice to a PHP packed array with indexed values only -* `frankenphp.GoAssociativeArray(arr unsafe.Pointer, ordered bool) frankenphp.AssociativeArray` - Convert a PHP array to an ordered Go AssociativeArray (map with order) -* `frankenphp.GoMap(arr unsafe.Pointer) map[string]any` - Convert a PHP array to an unordered go map -* `frankenphp.GoPackedArray(arr unsafe.Pointer) []any` - Convert a PHP array to a go slice +* `frankenphp.GoAssociativeArray(arr unsafe.Pointer, ordered bool) frankenphp.AssociativeArray` - Convert a PHP array to an ordered Go `AssociativeArray` (map with order) +* `frankenphp.GoMap(arr unsafe.Pointer) map[string]any` - Convert a PHP array to an unordered Go map +* `frankenphp.GoPackedArray(arr unsafe.Pointer) []any` - Convert a PHP array to a Go slice ### Declaring a Native PHP Class