PHP code example of jaeger / querylist-absolute-url

1. Go to this page and download the library: Download jaeger/querylist-absolute-url 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/ */

    

jaeger / querylist-absolute-url example snippets


use QL\QueryList;
use QL\Ext\AbsoluteUrl;

$ql = QueryList::getInstance();
$ql->use(AbsoluteUrl::class);
//or Custom function name
$ql->use(AbsoluteUrl::class,'absoluteUrl','absoluteUrlHelper');

$data = $ql->get('https://toutiao.io/')
	->absoluteUrl('https://toutiao.io/')
    ->find('a')->attrs('href');
    
print_r($data);

$data = $ql->rules([
    'link' => ['a','href']
])->get('https://toutiao.io/')->query()->getData(function ($item) use($ql){
    $item['link'] = $ql->absoluteUrlHelper('https://toutiao.io/',$item['link']);
    return $item;
});

print_r($data);