### Enable Offer Generation Per Starting Point (JSON) Source: https://github.com/pressmind/sdk/blob/master/documentation/config-touristic-data.md Example JSON configuration to enable generating a separate offer for each departure point. ```json "generate_offer_for_each_startingpoint_option": true ``` -------------------------------- ### Complete Configuration Example Source: https://github.com/pressmind/sdk/blob/master/documentation/config-server-database.md A full example of the configuration structure, including development server and database settings. ```json { "development": { "server": { "document_root": "/var/www/travelsite/httpdocs", "webserver_http": "https://www.my-travel-site.com", "php_cli_binary": "/usr/bin/php8.2", "timezone": "Europe/Berlin" }, "database": { "username": "pressmind_user", "password": "s3cur3_p4ssw0rd!", "host": "127.0.0.1", "port": "3306", "dbname": "pressmind_production", "engine": "MySQL" } } } ``` -------------------------------- ### Filesystem Bucket Example Source: https://github.com/pressmind/sdk/blob/master/documentation/config-image-file-handling.md Example of a 'bucket' configuration for filesystem storage, specifying a directory path. ```json "bucket": "WEBSERVER_DOCUMENT_ROOT/assets/images" ``` -------------------------------- ### Full PHP Example for Session Key Authentication Source: https://github.com/pressmind/sdk/blob/master/documentation/backend.md This example demonstrates full authentication using a custom session key 'myapp_user'. It includes functions for checking authentication status, getting user information, and generating login/logout URLs. Ensure the session is started before use. ```php // Ensure session is started for nonces and auth if (session_status() === PHP_SESSION_NONE) { session_start(); } $auth = new Pressmind Backend Auth CallbackProvider([ 'isAuthenticated' => function () { return !empty($_SESSION['myapp_user']); }, 'getCurrentUser' => function () { return $_SESSION['myapp_user']['name'] ?? null; }, 'getLoginUrl' => function ($returnUrl) { $base = '/myapp/login.php'; return $returnUrl !== '' ? $base . '?return=' . urlencode($returnUrl) : $base; }, 'getLogoutUrl' => function () { return '/myapp/logout.php'; }, 'renderLoginForm' => function () { return null; // we use external login page }, 'handleLoginRequest' => function () { return false; // login is handled by /myapp/login.php }, 'createNonce' => function (string $action) { $key = 'nonce_' . $action; if (!isset($_SESSION[$key])) { $_SESSION[$key] = bin2hex(random_bytes(16)); } return $_SESSION[$key]; }, 'verifyNonce' => function (string $nonce, string $action) { $key = 'nonce_' . $action; return isset($_SESSION[$key]) && hash_equals($_SESSION[$key], $nonce); }, ]); $app = new Pressmind Backend Application($auth); $app->handle(); ``` -------------------------------- ### Install Composer Dependencies and Run Unit Tests Source: https://github.com/pressmind/sdk/blob/master/documentation/testing.md Install project dependencies using Composer and then run the unit test suite. This is the basic setup for running tests locally without Docker. ```bash composer install --no-scripts composer test ``` -------------------------------- ### Logging Storage Examples Source: https://github.com/pressmind/sdk/blob/master/documentation/config-logging.md Provides examples for setting the `logging.storage` property to choose between database and filesystem logging. ```json // Default: Log to database "storage": "database" ``` ```json // Alternative: Log to files "storage": "filesystem" ``` -------------------------------- ### SDK CLI Import Example Source: https://github.com/pressmind/sdk/blob/master/documentation/cli-reference.md Example of how to perform a full import using the SDK CLI. ```APIDOC ## Example: Full Import This example demonstrates how to initiate a full import of all products from the PIM using the SDK CLI. ### Command ```bash php bin/import fullimport ``` ### Description This command triggers the `fullimport` subcommand, which fetches all media objects from the PIM, performs a full import for each, and executes subsequent post-import processes. ``` -------------------------------- ### Retrieve Starting Points by ID(s) (Bash) Source: https://github.com/pressmind/sdk/blob/master/documentation/pressmind-api-endpoints.md Example using curl to fetch starting point options by one or more IDs. Used for import of departure locations. ```bash curl -X GET \ "https://webcore.pressmind.io/v2-23/rest/{API_KEY}/StartingPoint/getById?ids[]=1&ids[]=2&cache=0" \ -H "Content-Type: application/json; charset=utf-8" \ -u "{API_USER}:{API_PASSWORD}" ``` -------------------------------- ### First-time Setup with Make Source: https://github.com/pressmind/sdk/blob/master/documentation/testing.md Follow these steps for initial setup, including building Docker images, running unit tests, and recording API snapshots for integration tests. ```bash # 1. Build Docker images make test-docker-build # 2. Run Unit tests (no services needed) make test-unit # 3. For ImportIntegration: set up API credentials and record a snapshot cp .env.example .env # Edit .env and fill in PM_API_KEY, PM_API_USER, PM_API_PASSWORD # 4. Record API snapshot (calls live pressmind API, saves responses as JSON fixtures) make test-record-api-snapshot # 5. Now run ImportIntegration tests (uses recorded fixtures, no live API needed) make test-import-integration # 6. Or run everything at once make test-all ``` -------------------------------- ### First-time Project Setup Source: https://github.com/pressmind/sdk/blob/master/documentation/makefile.md Commands for initial project setup, including building the Docker image, running unit tests, and optionally recording API snapshots for integration tests. ```bash make test-docker-build make test-unit # Optional: record API snapshot for ImportIntegration cp .env.example .env # edit .env with API credentials make test-record-api-snapshot make test-import-integration ``` -------------------------------- ### Configure Touristic Origins Examples Source: https://github.com/pressmind/sdk/blob/master/documentation/config-touristic-data.md Examples of how to define touristic origins in the configuration. ```json "origins": ["0"] ``` ```json "origins": ["0", "1", "2"] ``` ```json "origins": ["3"] ``` -------------------------------- ### S3 Bucket Example Source: https://github.com/pressmind/sdk/blob/master/documentation/config-image-file-handling.md Example of a 'bucket' configuration for S3 storage, specifying the S3 bucket name. ```json "bucket": "my-pressmind-images" ``` -------------------------------- ### Example Configuration for Media Types Source: https://github.com/pressmind/sdk/blob/master/documentation/config-touristic-data.md An example JSON structure for registering available media types, mapping their IDs to names. ```json "media_types": { "123": {"name": "Trip"}, "456": {"name": "Hotel"}, "789": {"name": "Attraction"} } ``` -------------------------------- ### Basic Auth Configuration Example (JSON) Source: https://github.com/pressmind/sdk/blob/master/documentation/backend.md Example JSON configuration for enabling basic authentication for the backend. Ensure username and password are provided. ```json "backend": { "enabled": true, "cli_runner": "APPLICATION_PATH/cli/run.php", "auth": { "provider": "basic_auth", "config": { "username": "admin", "password": "your-secret-password" } } } ``` -------------------------------- ### Server Configuration Example Source: https://github.com/pressmind/sdk/blob/master/documentation/config-server-database.md Defines fundamental environment settings for the server. ```json "server": { "document_root": "BASE_PATH/httpdocs", "webserver_http": "http://127.0.0.1", "php_cli_binary": "php", "timezone": "Europe/Berlin" } ``` -------------------------------- ### SSE Stream Example for Command Execution Source: https://github.com/pressmind/sdk/blob/master/documentation/rest-api-endpoints.md Illustrates the Server-Sent Events (SSE) stream format for command execution, including start, message, error, and complete events. ```text data: {"event":"start","message":"Process started"} data: {"type":"line","text":"Importing..."} event: complete data: {"event":"complete","success":true,"exitCode":0} ``` -------------------------------- ### Cache Key Format Examples Source: https://github.com/pressmind/sdk/blob/master/documentation/config-cache.md Defines the structure for cache keys and provides examples for setting the key prefix. ```json "key_prefix": "DATABASE_NAME" ``` ```json "key_prefix": "my_project" ``` ```json "key_prefix": "pressmind_staging" ``` -------------------------------- ### OpenSearch Server URI Examples Source: https://github.com/pressmind/sdk/blob/master/documentation/config-search.md Provides examples of OpenSearch server URI configurations for different deployment scenarios. ```json // Docker Compose "uri": "http://opensearch:9200" ``` ```json // Local "uri": "http://127.0.0.1:9200" ``` ```json // With HTTPS "uri": "https://opensearch.example.com:9200" ``` ```json // AWS OpenSearch Service "uri": "https://search-domain.region.es.amazonaws.com" ``` -------------------------------- ### Cache Types Configuration Examples Source: https://github.com/pressmind/sdk/blob/master/documentation/config-cache.md Provides examples of how to configure the 'types' array to enable specific caching mechanisms. ```json "types": ["REST", "SEARCH", "SEARCH_FILTER", "OBJECT", "MONGODB", "OPENSEARCH"] ``` ```json "types": ["REST"] ``` ```json "types": ["REST", "SEARCH", "SEARCH_FILTER", "MONGODB"] ``` -------------------------------- ### Redis Authentication Configuration Example Source: https://github.com/pressmind/sdk/blob/master/documentation/config-cache.md This JSON example demonstrates how to configure the password for an authenticated Redis connection within the cache adapter settings. ```json "config": { "host": "redis.example.com", "port": 6379, "password": "r3d1s_p4ss!" } ``` -------------------------------- ### Redis Host Examples Source: https://github.com/pressmind/sdk/blob/master/documentation/config-cache.md These JSON examples show different ways to configure the 'host' property for the Redis cache adapter, including local, Docker Compose, and external server configurations. ```json // Local Redis "host": "127.0.0.1" ``` ```json // Docker Compose "host": "redis" ``` ```json // External server "host": "redis.example.com" ``` -------------------------------- ### Pagination Examples Source: https://github.com/pressmind/sdk/blob/master/documentation/search-mongodb-api.md Demonstrates how to control pagination by specifying the page number and the number of results per page. ```text pm-l=1,12 // Page 1, 12 results per page pm-l=2,12 // Page 2, 12 results per page pm-l=1,24 // Page 1, 24 results per page pm-l=3,10 // Page 3, 10 results per page ``` -------------------------------- ### Complete OpenSearch Index Mapping Example Source: https://github.com/pressmind/sdk/blob/master/documentation/config-search.md An example demonstrating a complete OpenSearch index mapping configuration with 'code', 'headline_default', and 'subline_default' fields. ```json "index": { "code": { "type": "keyword", "object_type_mapping": { "607": [{"language": null, "field": {"name": "code", "params": []}}], "609": [{"language": null, "field": {"name": "code", "params": []}}] } }, "headline_default": { "type": "text", "object_type_mapping": { "607": [{"language": null, "field": {"name": "headline_default", "params": []}}], "609": [{"language": null, "field": {"name": "headline_default", "params": []}}] } }, "subline_default": { "type": "text", "boost": 2, "object_type_mapping": { "607": [{"language": null, "field": {"name": "subline_default", "params": []}}], "609": [{"language": null, "field": {"name": "subline_default", "params": []}}] } } } ``` -------------------------------- ### Example Calculation for CheapestPriceSpeed Entries Source: https://github.com/pressmind/sdk/blob/master/documentation/cheapest-price-aggregation.md Provides a concrete example of how the number of CheapestPriceSpeed entries is derived based on typical product data. ```plaintext 2 × 50 × 5 × 3 × 1 × 2 = 3,000 CheapestPriceSpeed entries ``` -------------------------------- ### Backend Configuration Example Source: https://context7.com/pressmind/sdk/llms.txt Example JSON configuration for the Pressmind SDK backend, specifying enablement, CLI runner path, and authentication provider details. ```json { "backend": { "enabled": true, "cli_runner": "APPLICATION_PATH/cli/run.php", "auth": { "provider": "password", "config": { "password": "change-me-in-production" } } } } ``` -------------------------------- ### REST Client API Key Example Source: https://github.com/pressmind/sdk/blob/master/documentation/config-rest-api.md Provides an example of a valid API key format for the REST client. ```json "api_key": "abc123def456ghi789" ``` -------------------------------- ### Example Configuration for Primary Media Type IDs Source: https://github.com/pressmind/sdk/blob/master/documentation/config-touristic-data.md Examples of how to configure `primary_media_type_ids` to restrict imports to specific object types or allow all types. ```json "primary_media_type_ids": [123, 456] // Allow all types (default) "primary_media_type_ids": null ``` -------------------------------- ### Example Configuration for Media Types Allowed Visibilities Source: https://github.com/pressmind/sdk/blob/master/documentation/config-touristic-data.md An example JSON structure defining which visibility levels are allowed for specific object types. ```json "media_types_allowed_visibilities": { "123": [30, 60], "456": [30, 60, 90] } ``` -------------------------------- ### Filesystem Logging Configuration Source: https://github.com/pressmind/sdk/blob/master/documentation/config-logging.md Example configuration for logging to the filesystem, specifying log path and retention. ```json "logging": { "mode": ["ERROR", "WARNING"], "storage": "filesystem", "log_file_path": "/var/log/pressmind", "lifetime": 2592000, "enable_advanced_object_log": false, "enable_database_query_logging": false } ``` -------------------------------- ### Example MyContent Class Mapping Source: https://github.com/pressmind/sdk/blob/master/documentation/config-touristic-data.md Demonstrates mapping MyContent IDs to custom importer classes. ```json "my_content_class_map": { "42": "\Custom\Import\HotelAmenities", "99": "\Custom\Import\TransferService" } ``` -------------------------------- ### Minimal PHP Example for API Key Authentication Source: https://github.com/pressmind/sdk/blob/master/documentation/backend.md This minimal example shows authentication using an API key from the 'X-API-KEY' header. It's suitable for scenarios where a full login form or session management is not required. For production, consider adding nonce verification and user identification. ```php $auth = new Pressmind Backend Auth CallbackProvider([ 'isAuthenticated' => function () { return isset($_SERVER['HTTP_X_API_KEY']) && $_SERVER['HTTP_X_API_KEY'] === getenv('BACKEND_API_KEY'); }, ]); $app = new Pressmind Backend Application($auth); $app->handle(); ``` -------------------------------- ### Logging Mode Examples Source: https://github.com/pressmind/sdk/blob/master/documentation/config-logging.md Illustrates different configurations for the `logging.mode` property to control which log types are stored. ```json // Only log errors (default, minimal) "mode": ["ERROR"] ``` ```json // Log errors and warnings "mode": ["ERROR", "WARNING"] ``` ```json // Log everything (debugging) "mode": ["ALL"] ``` ```json // Detailed logging for development "mode": ["DEBUG", "INFO", "WARNING", "ERROR", "FATAL"] ``` -------------------------------- ### Filter by URL Match Source: https://github.com/pressmind/sdk/blob/master/documentation/search-mongodb-api.md Example for finding a product by its specific URL path. ```text pm-url=/travel/5-beautiful-mallorca/ ``` -------------------------------- ### Minimal Logging Configuration (Production) Source: https://github.com/pressmind/sdk/blob/master/documentation/config-logging.md Example configuration for minimal logging, suitable for production environments. ```json "logging": { "mode": ["ERROR"], "categories": ["ALL"], "storage": "database", "lifetime": 604800, "keep_log_types": ["ERROR", "FATAL"], "enable_advanced_object_log": false, "enable_database_query_logging": false } ``` -------------------------------- ### PHP Example View Template Source: https://github.com/pressmind/sdk/blob/master/src/Pressmind/ObjectTypeScaffolderTemplates/Example.txt This PHP template is used for rendering the example view of a Media Object Type. It demonstrates how to access and display data such as the cheapest price and media object properties. ```php getCheapestPrice(); ?>

This is the Example View for Media Object Type "###OBJECTNAME###"

Open the file ###VIEWFILEPATH### in a text editor, to see how the information in this file was rendered

Cheapest Price

        toStdClass());?>
    

Properties for Media Type

###PROPERTYLIST###
``` -------------------------------- ### GET/POST /ibe/pressmind_ib3_v2_get_starting_point_options Source: https://github.com/pressmind/sdk/blob/master/documentation/rest-api-endpoints.md Retrieves available starting point (departure) options, with optional filtering and pagination. ```APIDOC ## GET/POST /ibe/pressmind_ib3_v2_get_starting_point_options ### Description Returns available starting point (departure) options. ### Method GET/POST ### Endpoint /ibe/pressmind_ib3_v2_get_starting_point_options ### Parameters #### Query Parameters - **data.id_starting_point** (integer) - Required - Starting point ID - **data.limit** (integer) - Optional - Results per page (default: 10) - **data.start** (integer) - Optional - Offset (default: 0) - **data.zip** (string) - Optional - ZIP code filter - **data.radius** (integer) - Optional - Radius in km (with `zip`) - **data.iic** (string) - Optional - IBE client identifier - **data.order_by_code_list** (array) - Optional - Custom sort order by codes ### Response #### Success Response (200) - **success** (boolean) - **data** (object) - Contains total count and a list of starting point options. ### Response Example ```json { "success": true, "data": { "total": 42, "starting_point_options": [ { "id": 1, "city": "Berlin", "code": "BER", ... }, { "id": 2, "city": "Munich", "code": "MUC", ... } ] } } ``` ``` -------------------------------- ### Full Debugging Logging Configuration Source: https://github.com/pressmind/sdk/blob/master/documentation/config-logging.md Example configuration for comprehensive debugging, enabling all logging features. ```json "logging": { "mode": ["ALL"], "categories": ["ALL"], "storage": "database", "log_file_path": "APPLICATION_PATH/logs", "lifetime": 86400, "keep_log_types": ["ERROR", "FATAL"], "enable_advanced_object_log": true, "enable_database_query_logging": true, "database_query_log_file": "APPLICATION_PATH/logs/db_query_log.txt" } ``` -------------------------------- ### Cache Primer Wrapper for WordPress Source: https://github.com/pressmind/sdk/blob/master/documentation/cli-wordpress-tools.md Boots WordPress using `Tools::boot()` and then runs the SDK Cache Primer command, passing the site URL for full URL output. The primer is CMS-agnostic. ```php init(new \Pressmind\Config\Adapter\Json('/path/to/config.json'), 'development'); // Access config anywhere via Registry $dbConfig = Registry::getInstance()->get('config')['database']; // $dbConfig['host'] === '127.0.0.1' // Database connection is auto-registered during init: $db = Registry::getInstance()->get('db'); ``` -------------------------------- ### Working with Prices Source: https://github.com/pressmind/sdk/blob/master/documentation/template-interface.md Illustrates how to retrieve the cheapest price for a media object and how to filter prices based on criteria like occupancy. ```php // Cheapest price for this media object $cheapest = $media_object->getCheapestPrice(); if(!is_null($cheapest)) { echo number_format($cheapest->price_total, 2, ',', '.') . ' €'; echo $cheapest->date_departure->format('d.m.Y'); echo $cheapest->duration . ' Tage'; echo $cheapest->transport_type; } // Cheapest prices with filters $filter = new \Pressmind\Search\CheapestPrice(); $filter->occupancy = 2; $prices = $media_object->getCheapestPrices($filter, ['price_total' => 'ASC'], [0, 10]); foreach($prices as $price) { echo $price->price_total; echo $price->date_departure->format('d.m.Y'); } ``` -------------------------------- ### OpenSearch User Authentication Example Source: https://github.com/pressmind/sdk/blob/master/documentation/config-search.md Example configuration for setting username and password for OpenSearch HTTP Basic Auth. ```json "user": "admin", "password": "admin" ``` -------------------------------- ### REST Client API Password Example Source: https://github.com/pressmind/sdk/blob/master/documentation/config-rest-api.md Provides an example of a password for HTTP Basic Authentication for the REST client. ```json "api_password": "s3cur3_api_p4ss" ``` -------------------------------- ### Complete Price Format Examples for Various Locales Source: https://github.com/pressmind/sdk/blob/master/documentation/config-sections-languages-misc.md Demonstrates price formatting configurations for different locales including German (Euro), US Dollar, Swiss Francs, and British Pounds, showing currency symbol position and separator usage. ```json // German (Euro) "price_format": { "de": { "decimals": 2, "decimal_separator": ",", "thousands_separator": ".", "position": "LEFT", "currency": "€" } } // Result: € 1.299,00 ``` ```json // English (US Dollar) "price_format": { "en": { "decimals": 2, "decimal_separator": ".", "thousands_separator": ",", "position": "LEFT", "currency": "$" } } // Result: $ 1,299.00 ``` ```json // Swiss Francs "price_format": { "ch": { "decimals": 2, "decimal_separator": ".", "thousands_separator": "'", "position": "LEFT", "currency": "CHF" } } // Result: CHF 1'299.00 ``` ```json // British Pounds (currency after amount) "price_format": { "en_gb": { "decimals": 2, "decimal_separator": ".", "thousands_separator": ",", "position": "RIGHT", "currency": "£" } } // Result: 1,299.00 £ ``` ```json // Multiple locales "price_format": { "de": { "decimals": 2, "decimal_separator": ",", "thousands_separator": ".", "position": "LEFT", "currency": "€" }, "en": { "decimals": 2, "decimal_separator": ".", "thousands_separator": ",", "position": "LEFT", "currency": "€" } } ``` -------------------------------- ### REST Client API User Example Source: https://github.com/pressmind/sdk/blob/master/documentation/config-rest-api.md Provides an example of a username for HTTP Basic Authentication for the REST client. ```json "api_user": "import_user" ``` -------------------------------- ### Standalone Backend Entry Point Source: https://github.com/pressmind/sdk/blob/master/documentation/backend.md Create a PHP entry script to bootstrap the SDK and run the management backend application when not integrated with WordPress. ```php handle(); ``` -------------------------------- ### Bootstrapping WordPress Backend Source: https://github.com/pressmind/sdk/blob/master/documentation/backend.md Initializes the backend within a WordPress theme, ensuring proper authentication and capabilities. Loads WordPress via SDK's Tools::boot() to handle authentication and capabilities correctly. ```php handle(); ``` -------------------------------- ### Initialize OpenSearch Indexer and Create Templates Source: https://github.com/pressmind/sdk/blob/master/documentation/search-opensearch.md Use the SDK to automatically create OpenSearch index templates and indexes. This is typically done during the first `upsertMediaObject()` call. ```php $indexer = new \Pressmind\Search\OpenSearch\Indexer(); $indexer->createIndexTemplates(); // Creates templates + indexes $indexer->createIndexes(); // Indexes all media objects ``` -------------------------------- ### GeoJSON MultiPoint Object Example Source: https://github.com/pressmind/sdk/blob/master/documentation/search-mongodb-index-configuration.md Example of a GeoJSON `MultiPoint` object storing latitude and longitude pairs for geographic search. ```json { "locations": { "destination": { "type": "MultiPoint", "coordinates": [[13.4050, 52.5200], [11.5820, 48.1351]] } } } ``` -------------------------------- ### Custom Controller Registration Example Source: https://github.com/pressmind/sdk/blob/master/documentation/rest-api-endpoints.md Custom controllers in the `\Custom\REST\Controller\` namespace are automatically registered. The example shows a basic structure for an availability controller. ```php namespace Custom\REST\Controller; class Availability { public function index($parameters) { $id = $parameters['id_media_object'] ?? null; // Custom availability logic return [ 'available' => true, 'rooms' => 5, 'last_updated' => date('c') ]; } } ``` -------------------------------- ### Validator Output Example (Error) Source: https://github.com/pressmind/sdk/blob/master/documentation/troubleshooting-missing-products.md Example output from the built-in validator highlighting an error where the object type is not configured in the search build_for settings. ```text Validation: MongoDB Indexer ❌ id_object_type 607 is not configured in search.build_for. CONFIGURED: [609] ``` -------------------------------- ### Legacy Wrapper: Display Help Source: https://github.com/pressmind/sdk/blob/master/documentation/cli-reference.md Displays help information for the legacy import script. ```bash cd /path/to/wp-content/themes/travelshop php cli/import.php help ``` -------------------------------- ### Perform Full Import via SDK CLI Source: https://github.com/pressmind/sdk/blob/master/documentation/cli-reference.md Initiates a full import of all media objects from the PIM using the SDK CLI. This is the recommended method for SDK users. ```bash php bin/import fullimport ``` -------------------------------- ### Example Configuration for Disabling Recursive Import Source: https://github.com/pressmind/sdk/blob/master/documentation/config-touristic-data.md An example JSON structure specifying which fields should have recursive imports disabled for particular object types. ```json "disable_recursive_import": { "123": ["unterkuenfte_default", "transfers_default"], "456": ["verwandte_reisen_default"] } ``` -------------------------------- ### PHP pm-config.php Structure Example Source: https://github.com/pressmind/sdk/blob/master/documentation/config-examples.md Defines the basic structure of the pm-config.php file, showing how to set up different environments like development, testing, and production. It highlights the use of environment-specific overrides for credentials and server URLs. ```php [ 'server' => [ ... ], 'database' => [ ... ], 'rest' => [ ... ], 'data' => [ ... ], 'cache' => [ ... ], 'image_handling' => [ ... ], // ... ], 'testing' => [], 'production' => [ 'server' => [ 'webserver_http' => 'https://www.example.com' ], 'database' => [ 'username' => '...', 'password' => '...', 'dbname' => '...' ], 'data' => [ 'search_mongodb' => [ 'database' => [ 'uri' => '...', 'db' => '...' ], ], ], ], ]; ``` -------------------------------- ### Example for Media Type Custom Import Hooks Source: https://github.com/pressmind/sdk/blob/master/documentation/config-touristic-data.md Provides specific examples of custom import classes for object types 123 and 456. ```json "media_type_custom_import_hooks": { "123": [ "\Custom\Import\HotelRatingSync", "\Custom\Import\GeoCoordinateEnricher" ], "456": [ "\Custom\Import\FlightDataProcessor" ] } ``` -------------------------------- ### boot Source: https://github.com/pressmind/sdk/blob/master/documentation/cli-wordpress-tools.md Loads WordPress in headless mode. Optionally loads admin files for database and option manipulation. ```APIDOC ## boot ### Description Loads WordPress in headless mode (no theme rendering). Defines `WP_USE_THEMES` as `false` if not already set, then includes `wp-load.php`. Optionally loads `wp-admin/includes/admin.php` (required for `$wpdb`, `update_option()`, and similar). ### Method Signature ```php public static function boot(bool $loadAdmin = false): void ``` ### Parameters #### Path Parameters - **$loadAdmin** (bool) - Optional - If `true`, also require `wp-admin/includes/admin.php`. ### Throws - `RuntimeException` if the WordPress base path cannot be found (no `wp-config.php` in parent directories). ### Idempotent Calling `boot()` again after a successful call has no effect. ### Example ```php \Pressmind\CLI\WordPress\Tools::boot(true); // Now $wpdb, get_option(), update_option(), etc. are available. ``` ``` -------------------------------- ### Run SDK CLI Commands Source: https://github.com/pressmind/sdk/blob/master/documentation/cli-reference.md Recommended way to run CLI commands using the SDK's bin scripts. Requires a valid configuration file. ```bash php bin/import fullimport php bin/index-mongo all php bin/rebuild-cache ``` -------------------------------- ### Enable Offer Generation Per Board Type (JSON) Source: https://github.com/pressmind/sdk/blob/master/documentation/config-touristic-data.md Example JSON configuration to enable generating a separate offer for each board type. ```json "generate_offer_for_each_option_board_type": true ``` -------------------------------- ### Validator Output Example (Success) Source: https://github.com/pressmind/sdk/blob/master/documentation/troubleshooting-missing-products.md Example output from the built-in validator showing successful checks for object type configuration, duration ranges, and group configuration. ```text Validation: MongoDB Indexer ✅ id_object_type 607 is configured in build_for Origin 0, no agency: ✅ Durations [7, 14 days] match configured ranges [1-3, 4-7, 8-99] ✅ Groups config OK (field: agencies) ``` -------------------------------- ### Filter Class Example Source: https://github.com/pressmind/sdk/blob/master/documentation/search-mongodb-index-configuration.md Example PHP filter class demonstrating how to access media object and agency properties, and defining a static method to process field values. ```php class Filter { public $mediaObject; public $agency; public static function firstPicture($value, $derivative = 'teaser') { // $value = raw field data (e.g. array of image objects) // $derivative = from params config // return: transformed value for the document } public static function strip($value) { return strip_tags($value); } public static function lastTreeItemAsString($value) { // Extract last tree path item as a readable string } } ``` -------------------------------- ### Example Configuration for Custom Post-Import Hooks Source: https://github.com/pressmind/sdk/blob/master/documentation/config-touristic-data.md An example JSON structure for defining custom post-import hooks, mapping object type IDs to an array of class names. ```json "media_type_custom_post_import_hooks": { "123": [ "\Custom\PostImport\SearchIndexUpdater", "\Custom\PostImport\CacheWarmer" ] } ``` -------------------------------- ### PHP: Calculate Starting Point Price Source: https://github.com/pressmind/sdk/blob/master/documentation/cheapest-price-aggregation.md Calculates the price for a starting point option. It differentiates between price per day and a one-time price, multiplying by duration if necessary. ```php $starting_point_price = $StartingPointOption->price_per_day ? $StartingPointOption->price × $duration : $StartingPointOption->price; ``` -------------------------------- ### Accessing Configuration in PHP Source: https://github.com/pressmind/sdk/blob/master/documentation/configuration.md Demonstrates how to retrieve the configuration object from the SDK's Registry and access specific values, such as the database host. ```php $config = \Pressmind\Registry::getInstance()->get('config'); $value = $config['database']['host']; ``` -------------------------------- ### Configure Max Offers Per Product (JSON) Source: https://github.com/pressmind/sdk/blob/master/documentation/config-touristic-data.md Example JSON configuration setting the maximum number of offers to generate per product to 5000. ```json "max_offers_per_product": 5000 ``` -------------------------------- ### Example Search Hook Configuration Source: https://github.com/pressmind/sdk/blob/master/documentation/config-search.md An example of a detailed search hook configuration, including class, enabled status, API URL, object types, default parameters, and caching settings. ```json "search_hooks": [ { "class": "\\Custom\\Search\\Hook\\ExternalApiProvider", "config": { "enabled": true, "api_url": "https://api.example.com/offers", "object_types": [123, 456], "default_params": { "per_page": 500 }, "priority": 10, "redis": { "enabled": true, "host": "127.0.0.1", "port": 6379, "password": null, "database": 2, "prefix": "myapp:search:", "ttl": 10800 }, "runtime_cache": { "enabled": true } } } ] ``` -------------------------------- ### Example View Template for Media Type Source: https://github.com/pressmind/sdk/blob/master/documentation/template-interface.md Demonstrates accessing ORM properties within a view template. Includes accessing basic properties, iterating over relations like images, and retrieving the cheapest price. ```php getCheapestPrice(); ?>

This is the Example View for Media Object Type "Reise"

Cheapest Price

toStdClass());?>

Properties for Media Type

headline_default
headline_default;?>
bilder_default
bilder_default as $bilder_default_item) {?> <?php echo $bilder_default_item->alt;?>
```