PHP code example of texnixe / similar

1. Go to this page and download the library: Download texnixe/similar 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/ */

    

texnixe / similar example snippets


'fields' => 'tags'

'fields' => ['tags', 'size', 'category']

'fields' => ['tags' => 1, 'size' => 1.5, 'category' => 3]

'fields' => ['tags' => 0.5, 'size' => 2, 'category' => 1]



$similarPages = $page->similar($options);

foreach($similarPages as $p) {
  echo $p->title();
}




$similarImages = $image->similar($options);

foreach($similarImages as $image) {
  echo $image->filename();
}



$similarPages = $page->similar([
  'index' => $page->siblings(false)->listed(),
  'fields'         => 'tags',
  'threshold'      => 0.2,
  'delimiter'      => ',',
  'languageFilter' => false
]);