### Install MaxMind DB Extension from Source
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/maxmind-db/reader/README.md
Steps to compile and install the MaxMind DB C extension from source. This involves navigating to the extension directory, configuring, compiling, and installing.
```bash
cd ext
phpize
./configure
make
make test
sudo make install
```
--------------------------------
### Download Composer Installer
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/maxmind-db/reader/README.md
Downloads the Composer installer script. This is the first step for installing the MaxMind DB Reader using Composer.
```bash
curl -sS https://getcomposer.org/installer | php
```
--------------------------------
### Install Highlight.js via npm
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/ui/install/js/ui/highlightjs/README.md
Install the Highlight.js library using npm for use in a CommonJS environment.
```bash
npm install highlight.js --save
```
--------------------------------
### Full GeoIP2 Web Service Client Example
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/geoip2/geoip2/README.md
A comprehensive example demonstrating the instantiation of the client, performing a city lookup, and accessing various details from the returned record, including country, subdivision, city, postal code, location, and network traits.
```php
city('128.101.101.101');
print($record->country->isoCode . "\n"); // 'US'
print($record->country->name . "\n"); // 'United States'
print($record->country->names['zh-CN'] . "\n"); // '美国'
print($record->mostSpecificSubdivision->name . "\n"); // 'Minnesota'
print($record->mostSpecificSubdivision->isoCode . "\n"); // 'MN'
print($record->city->name . "\n"); // 'Minneapolis'
print($record->postal->code . "\n"); // '55455'
print($record->location->latitude . "\n"); // 44.9733
print($record->location->longitude . "\n"); // -93.2323
print($record->traits->network . "\n"); // '128.101.101.101/32'
```
--------------------------------
### Install GeoIP2 Dependencies with Composer
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/geoip2/geoip2/README.md
Install the GeoIP2 package and its dependencies using Composer.
```bash
php composer.phar require geoip2/geoip2:~2.0
```
--------------------------------
### Install Promise Component with Composer
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/php-http/promise/README.md
Use Composer to install the php-http/promise package. This is the standard method for adding the library to your project.
```bash
$ composer require php-http/promise
```
--------------------------------
### Install Recurr with Composer
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/simshaun/recurr/README.md
The recommended method for installing Recurr is via Composer. This command adds the library to your project dependencies.
```bash
composer require simshaun/recurr
```
--------------------------------
### Install MaxMind DB Extension via PECL
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/maxmind-db/reader/README.md
Command to install the MaxMind DB C extension using PECL. Ensure libmaxminddb is installed first.
```bash
pecl install maxminddb
```
--------------------------------
### Install MaxMind DB Reader with Composer
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/maxmind-db/reader/README.md
Installs the MaxMind DB Reader package and its dependencies using Composer. This command should be run in the project root directory.
```bash
php composer.phar require maxmind-db/reader:~1.0
```
--------------------------------
### Install MaxMind DB Reader via DNF (Fedora)
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/maxmind-db/reader/README.md
Installs the php-maxminddb package on Fedora systems using the DNF package manager. Note that these packages are not maintained by MaxMind.
```bash
dnf install php-maxminddb
```
--------------------------------
### Update and Build pdf.js
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/ui/install/js/ui/pdfjs/README.md
Follow these steps to update the pdf.js version, install npm dependencies, and run the Bitrix installation. This process ensures the new pdf.js is available within the BX.UI.Pdfjs namespace.
```shell
# update package.json to use the new version of pdf.js
cd ui/install/js/ui/pdfjs
npm install
bitrix install
```
--------------------------------
### Install PHPMailer via Composer CLI
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/phpmailer/phpmailer/README.md
Alternatively, run this command in your terminal to install PHPMailer using Composer.
```sh
composer require phpmailer/phpmailer
```
--------------------------------
### Prepend to Stream Body
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/psr/http-message/docs/PSR7-Usage.md
Demonstrates prepending content to a stream by writing new content and then seeking to the start to overwrite existing data.
```php
$body = $repsonse->getBody();
$body->write('abcd');
$body->seek(0);
$body->write('ef'); // at this point the stream contains "efcd"
```
--------------------------------
### Domain Lookup Example
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/geoip2/geoip2/README.md
Retrieve the domain name associated with an IP address using the GeoIP2-Domain database. The Reader object should be reused.
```php
domain('128.101.101.101');
print($record->domain . "\n"); // 'umn.edu'
print($record->ipAddress . "\n"); // '128.101.101.101'
print($record->network . "\n"); // '128.101.101.101/32'
```
--------------------------------
### Install MaxMind DB Reader via YUM (CentOS/RHEL 7)
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/maxmind-db/reader/README.md
Installs the php-maxminddb package on CentOS or RHEL 7 systems using the YUM package manager, after enabling the EPEL repository. Note that these packages are not maintained by MaxMind.
```bash
yum install php-maxminddb
```
--------------------------------
### Responsive Pie Chart Configuration
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/install/js/main/amcharts/3.21/plugins/responsive/examples/pie2.html
Configure a pie chart with responsive capabilities enabled. This setup is suitable for dynamic data visualization that needs to adapt to various display environments.
```javascript
AmCharts.makeChart("chartdiv", {
"type": "pie",
"titles": [
{
"text": "Visitors countries",
"size": 16
}
],
"dataProvider": [
{
"country": "United States",
"visits": 7252
},
{
"country": "China",
"visits": 3882
},
{
"country": "Japan",
"visits": 1809
},
{
"country": "Germany",
"visits": 1322
},
{
"country": "United Kingdom",
"visits": 1122
},
{
"country": "France",
"visits": 414
},
{
"country": "India",
"visits": 384
},
{
"country": "Spain",
"visits": 211
}
],
"valueField": "visits",
"titleField": "country",
"startEffect": "elastic",
"startDuration": 2,
"labelRadius": 15,
"innerRadius": "50%",
"depth3D": 10,
"balloonText": "[[title]] [[value]] ([[percents]]%)",
"angle": 15,
"legend": {
"position": "right"
},
"responsive": {
"enabled": true
}
});
```
--------------------------------
### Standalone Installation Autoloader
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/maxmind-db/reader/README.md
Includes the custom autoloader file provided with the MaxMind DB Reader package when not using Composer. This allows direct instantiation of the Reader class.
```php
require('/path/to/MaxMind-DB-Reader-php/autoload.php');
```
--------------------------------
### Configure DataLoader in Object-Based Chart Setup
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/install/js/main/amcharts/3.21/plugins/dataloader/readme.md
Assign a 'dataLoader' configuration object to the chart object's 'dataLoader' property when using an object-based chart setup. This example demonstrates loading CSV data.
```javascript
var chart = new AmCharts.AmSerialChart();
...
chart["dataLoader"] = {
"url": "data.csv",
"format": "csv",
"delimiter": ",",
"useColumnNames": true,
"skip": 1
};
```
--------------------------------
### Configure Monthly Recurrence End-of-Month Behavior
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/simshaun/recurr/README.md
Enables a fix for monthly recurring rules to correctly handle start dates on the 29th, 30th, or 31st, ensuring subsequent months are included even if they don't have that many days. For example, it ensures Jan 31 + 1 month results in Feb 28/29, not March.
```php
$timezone = 'America/New_York';
$startDate = new
DateTime('2013-01-31 20:00:00', new
DateTimeZone($timezone));
$rule = new
Recurr
Rule('FREQ=MONTHLY;COUNT=5', $startDate, null, $timezone);
$transformer = new
Recurr
Transformer
ArrayTransformer();
$transformerConfig = new
Recurr
Transformer
ArrayTransformerConfig();
$transformerConfig->enableLastDayOfMonthFix();
$transformer->setConfig($transformerConfig);
print_r($transformer->transform($rule));
```
--------------------------------
### Instantiate Client with Language Preferences and Options
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/geoip2/geoip2/README.md
Instantiate the client with additional arguments for language preferences and options like host and timeout. This example shows how to use the GeoLite2 web service.
```php
$client = new Client(42, 'abcdef123456', ['en'], ['host' => 'geolite.info']);
```
--------------------------------
### Configure Simple Export Menu
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/install/js/main/amcharts/3.21/plugins/export/README.md
Sets up a basic export menu with options for PNG, JPG, and CSV formats. This configuration results in a two-level hierarchical menu.
```javascript
"export": {
"enabled": true,
"menu": [ {
"class": "export-main",
"menu": [ "PNG", "JPG", "CSV" ]
} ]
}
```
--------------------------------
### Install Parsedown with Composer
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/ai/vendor/erusev/parsedown/README.md
Use Composer to install the Parsedown package for your PHP project.
```sh
composer require erusev/parsedown
```
--------------------------------
### Configure Highlight.js with Almond Optimizer
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/ui/install/js/ui/highlightjs/README.md
Use the Almond optimizer to specify a module name for Highlight.js when using it with Almond.
```bash
r.js -o name=hljs paths.hljs=/path/to/highlight out=highlight.js
```
--------------------------------
### MP3 Selling Module Configuration Variables
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/sale/install/sample/mp3/readme_english.txt
Define these variables at the beginning of init_vars.php to configure pricing, currency, access duration, and user account top-up options for MP3 sales.
```php
$mp3Price - price of one MP3 track
$mp3Currency - currency of price of one MP3 track
$mp3AccessTimeLength - period of time during which the track can be accessed
$mp3AccessTimeType - time unit of the above period (possible values: I - minute, H - hour, D - day, W - week, M - month, Q - quarter, S - half year, Y - year)
$arMP3Sums - array of possible amounts a user can add to their account; has the following format:
array(
product_ID = "> array (";
"PRICE" = "> top_up_amount,";
"CURRENCY" = "> currency_of_top_up_amount";
),
...
)
The system treats each amount as a separate product.
```
--------------------------------
### Instantiate GeoIP2 Web Service Client
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/geoip2/geoip2/README.md
Create a new GeoIp2\WebService\Client object with your account ID and license key. This client can be reused across multiple requests.
```php
$client = new Client(42, 'abcdef123456');
```
--------------------------------
### Initialize Highlight.js on Load
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/ui/install/js/ui/highlightjs/README.md
Include these files and call initHighlightingOnLoad to automatically highlight code blocks on page load. Ensure the CSS file is linked.
```html
```
--------------------------------
### AmCharts Chart Initialization and Animation Start
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/install/js/main/amcharts/3.21/plugins/animate/examples/serial_column.html
Attaches an event listener to the chart's 'init' event to start the data animation loop after a short delay.
```javascript
chart.addListener("init", function () {
setTimeout(loop, 1000);
});
```
--------------------------------
### Get PSR-7 Stream Contents
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/psr/http-message/docs/PSR7-Usage.md
Retrieve the entire content of a PSR-7 stream using `getContents()`. Ensure the stream is rewound using `rewind()` or `seek(0)` before reading to get all content.
```php
$body = $response->getBody();
$body->rewind(); // or $body->seek(0);
$bodyText = $body->getContents();
```
--------------------------------
### Custom Initialization with jQuery
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/ui/install/js/ui/highlightjs/README.md
Iterate over code blocks using jQuery and apply highlighting individually with highlightBlock for more control.
```javascript
$(document).ready(function() {
$('pre code').each(function(i, block) {
hljs.highlightBlock(block);
});
});
```
--------------------------------
### Install PSR Log via Composer
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/psr/log/README.md
Use this command to add the PSR-3 logger interface package to your project dependencies.
```bash
composer require psr/log
```
--------------------------------
### Run Tests for Promise Component
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/php-http/promise/README.md
Execute the test suite for the Promise component using Composer. This command runs the tests defined in the project.
```bash
$ composer test
```
--------------------------------
### Radar Chart with Responsive Plugin
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/install/js/main/amcharts/3.21/plugins/responsive/examples/radar.html
Configures a radar chart with sample data and enables the responsive plugin. Use this for creating dynamic charts that adjust to screen size.
```javascript
body, html { height: 100%; padding: 0; margin: 0; }
var chart = AmCharts.makeChart("chartdiv", {
"type": "radar",
"dataProvider": [
{ "country": "Czech Republic", "litres": 156.9 },
{ "country": "Ireland", "litres": 131.1 },
{ "country": "Germany", "litres": 115.8 },
{ "country": "Australia", "litres": 109.9 },
{ "country": "Austria", "litres": 108.3 },
{ "country": "UK", "litres": 99 }
],
"categoryField": "country",
"startDuration": 2,
"valueAxes": [
{
"axisAlpha": 0.15,
"minimum": 0,
"dashLength": 3,
"axisTitleOffset": 20,
"gridCount": 5
}
],
"graphs": [
{
"valueField": "litres",
"title": "Litres",
"bullet": "round",
"balloonText": "\[\[value\]\] litres of beer per year"
}
],
"legend": {},
"responsive": {
"enabled": true
}
});
```
--------------------------------
### Include init_vars.php in init.php
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/sale/install/sample/mp3/readme_english.txt
Include the init_vars.php file in your site's main init.php to load module-specific variables. Ensure the path to init_vars.php is correct.
```php
include_once($_SERVER["DOCUMENT_ROOT"]."/mp3/init_vars.php");
?>
```
--------------------------------
### Override Properties of All Array Items
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/install/js/main/amcharts/3.13/plugins/responsive/readme.md
This example shows how to override properties for all items within an array, such as setting a 'bullet' and 'lineThickness' for all graphs on the chart.
```javascript
"graphs": {
"bullet": "round",
"lineThickness": 5
}
```
--------------------------------
### Instantiate MaxMind DB Reader (Standalone)
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/maxmind-db/reader/README.md
Instantiates the MaxMind DB Reader class with the path to a MaxMind DB file. This is used after including the standalone autoloader.
```php
use MaxMind\Db\Reader;
$reader = new Reader('example.mmdb');
```
--------------------------------
### Transform RRULE to DateTime Objects
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/simshaun/recurr/README.md
Use the ArrayTransformer to convert a Rule object into a RecurrenceCollection of Recurrence objects, each containing start and end DateTime objects.
```php
$transformer = new \Recurr\Transformer\ArrayTransformer();
print_r($transformer->transform($rule));
```
--------------------------------
### AmCharts Serial Chart Configuration
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/install/js/main/amcharts/3.21/plugins/export/examples/serial2.html
Configure a serial chart with data, axes, graphs, and legend. This setup is suitable for displaying time-series data or comparisons.
```javascript
var chart = AmCharts.makeChart( "chartdiv", {
"type": "serial",
"theme": "dark",
"dataProvider": [
{ "year": 2005, "income": 23.5, "expenses": 18.1 },
{ "year": 2006, "income": 26.2, "expenses": 22.8 },
{ "year": 2007, "income": 30.1, "expenses": 23.9 },
{ "year": 2008, "income": 29.5, "expenses": 25.1 },
{ "year": 2009, "income": 24.6, "expenses": 25 }
],
"categoryField": "year",
"startDuration": 1,
"rotate": true,
"categoryAxis": {
"gridPosition": "start"
},
"valueAxes": [
{
"position": "bottom",
"title": "Million USD",
"minorGridEnabled": true
}
],
"graphs": [
{
"type": "column",
"title": "Income",
"valueField": "income",
"fillAlphas": 1,
"balloonText": "[[title]] in [[category]]:[[value]]"
},
{
"type": "line",
"title": "Expenses",
"valueField": "expenses",
"lineThickness": 2,
"bullet": "round",
"balloonText": "[[title]] in [[category]]:[[value]]"
}
],
"legend": {
"useGraphSettings": true
},
"creditsPosition": "top-right",
"export": {
"enabled": true,
"fileName": "exportedChart",
"backgroundColor": "#282828",
"exportTitles": true,
"columnNames": {
"year": "Year",
"income": "Income, USD",
"expenses": "Expenses, USD"
},
"processData": function (data) {
return data.slice(1, -1);
}
}
}
);
```
--------------------------------
### Format Specific Options with menuReviver
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/install/js/main/amcharts/3.21/plugins/export/README.md
The `menuReviver` can also be used to override format-specific parameters. This example shows how to change the CSV delimiter to a tab character.
```javascript
"export": {
"enabled": true,
"menuReviver": function(cfg,li) {
if ( cfg.format == "CSV" ) {
cfg.delimiter = "\t";
}
return li;
}
}
```
--------------------------------
### Import All Languages with CommonJS
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/ui/install/js/ui/highlightjs/README.md
Import the entire Highlight.js library, which includes all languages by default, using CommonJS.
```javascript
import hljs from 'highlight.js';
```
--------------------------------
### Function to Set Iframe Source
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/install/js/main/amcharts/3.13/plugins/responsive/examples/index.html
Sets the 'src' attribute of an iframe element to a specified URL, typically used to load different chart examples.
```javascript
function setType (type) {
$('#iframe').attr('src', type);
}
```
--------------------------------
### Require Composer Autoloader
Source: https://github.com/alex-jazzman/bitrix24_source/blob/master/bitrix/modules/main/vendor/maxmind-db/reader/README.md
Includes the Composer autoloader file in your PHP script to enable class autoloading for installed packages like the MaxMind DB Reader.
```php
require 'vendor/autoload.php';
```