Download the PHP package spresnac/laravel-url-helper without Composer
On this page you can find all versions of the php package spresnac/laravel-url-helper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-url-helper
URL Helper Package
Content:
- Installation
- Usage
- Content Helper
- URL Helper
- Sitemap Helper
- Tests
- Finally
Installation
First things first, so require the package:
Usage
Content Helper
Every time you need to get URLs from some kind of Text or HTML, this class is a helping hand for you.
- Make an instance of the class
- Use the constructor or the
setContent
method to put in your content as string. - Get your URLs by using one of the following methods.
getContent(): string
This will just the content you put in via constructor or setContent
method.
getHrefs(): Collection
You will retrieve a Collection with only the URLs inside a href
getHrefsAsArray(): array
You will retrieve an array with only the URLs inside a href
getSrcUrls(): Collection
You will retrieve a collection of urls from src
sources.
getLinksFromPlaintext(): Collection
This method will try to find all the urls in a plaintext string.
getAllTheLinks(): Collection
This will execute getHrefs
, getSrcUrls
and getLinksFromPlaintext
and will return a uniqueified collection of all the urls.
URL Helper
Some useful helper functions to handle URL related manipulating or info-gatherings.
normalize_url(string $url): string|false
Normalizes URL with .. in it and leaves the all oher URL "as is".
Returns false
in case of error
build_url(array $parsed_url): string
This is the missing opposite of parse_url
to rebuild a url from its parts.
getMainDomainPart(string $url): string
This will return the "Main Domain" part of an URL. The "Main Domain" is like the SLD + TLD domain part.
getSubdomainPart(string $url): string
This will return the Subdomain part of an URL.
Sitemap Helper
Handling with web-sitemaps can be handy with some helpers at your side.
process_input_from_string(string $input_string): Collection
Will return all the urls inside a sitemap as Collection
process_input_from_url(string $input_url): Collection (0.5+)
Returns the urls in a sitemap url as Collection
Tests
Simply run
or
Finally
Be productive 😉
All versions of laravel-url-helper with dependencies
ext-simplexml Version *
ext-curl Version *