PHP code example of proklung / bitrix-primitive-router

1. Go to this page and download the library: Download proklung/bitrix-primitive-router 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/ */

    

proklung / bitrix-primitive-router example snippets


$APPLICATION->IncludeComponent('bitrix-primitive-router:base.router', '', array(
    "CACHE_TYPE" => "A",
    "CACHE_TIME" => 3600,
    "SEF_FOLDER" => '/article/',
    "SEF_MODE" => "Y",
    "SEF_URL_TEMPLATES" => array(
        "detail" => "#ELEMENT_ID#/",
        "index" => "index.php",
    ),
));

$APPLICATION->IncludeComponent('bitrix-primitive-router:rest.router', '', [
    'SEF_FOLDER' => '/rest/',
    'SEF_URL_PATHS' =>[
      'article/get-list/' => 'Local\Rest\Article::getlist()',
      'article/get-detail/' => 'Local\Rest\Article::getDetail()',
      'article/upsert/' => 'Local\Rest\Article::upsert()',
     ]
]);