1. Go to this page and download the library: Download civicrm/php-array-doc library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
civicrm / php-array-doc example snippets
return [
// First item is a string.
'key_1' => 'value_1',
// Second item is an array of floats.
'key_2' => [2.1, 2.2, 2.3],
// Third item is an array.
'key_3' => [
'part_a' => 'Apple',
'part_b' => 'Banana',
]
];
use MyHelper as H;
return [
'id' => 1234,
'name' => 'greeter',
'label' => H::translate('Hello World'),
];
use MyHelper as H;
return H::record([
'id' => 1234,
'name' => 'greeter',
'label' => H::translate('Hello World'),
]);
use MyHelper as H;
return H::record([
'id' => 1234,
'name' => 'greeter',
'label' => fn() => H::translate('Hello World'),
]);