1. Go to this page and download the library: Download spresnac/laravel-url-helper 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/ */
spresnac / laravel-url-helper example snippets
$content_helper = new ContentHelper('insert HTML here');
$result = $content_helper->getHrefs();
// $result is an Collection with all the hrefs in it.
$content_helper = new ContentHelper('insert HTML here');
$result = $content_helper->getHrefsAsArray();
// $result is an Collection with all the hrefs in it.
$content_helper = new ContentHelper('insert HTML here');
$result = $content_helper->getSrcUrls();
// $result is an Collection with all the src-urls in it.
$content_helper = new ContentHelper('insert some plaintext here');
$result = $content_helper->getLinksFromPlaintext();
// $result is an Collection with all the urls from the plaintext in it.
$content_helper = new ContentHelper('insert some html or plaintext here');
$result = $content_helper->getAllTheLinks();
// $result is an Collection with all the urls.
$url_helper = new URLHelper();
$normalized_url = $url_helper->normalize('https://example.com/my/dir/with/two/../init.html');
// $normalized_url is now https://example.com/my/dir/with/init.html
$url_helper = new URLHelper();
$parsed_url = parse_url('https://example.com/test/url.php');
$my_url = $url_helper->build_url($parsed_url);
$url_helper = new URLHelper();
$main_domain_part = $url_helper->getMainDomainPart('https://www3.example.com/some/url');
// $main_domain_part is now "example.com"
$url_helper = new URLHelper();
$sub_domain_part = $url_helper->getMainDomainPart('https://www3.brick.example.com/some/url');
// $sub_domain_part is now "www3.brick"
$sitemap_helper = new SitemapHelper();
$urls = $sitemap_helper->process_input_from_string('content_of_your_sitemap_as_string');
// $urls are a collection of all the urls found
$sitemap_helper = new SitemapHelper();
$urls = $sitemap_helper->process_input_from_url('url_to_your_sitemap');
// $urls are a collection of all the urls found
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.