Download the PHP package roberthucks/seo-magic without Composer
On this page you can find all versions of the php package roberthucks/seo-magic. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download roberthucks/seo-magic
More information about roberthucks/seo-magic
Files in roberthucks/seo-magic
Package seo-magic
Short Description How do you get SEO working when you get tricked in to making an SPA? Magic.
License
Informations about the package seo-magic
SEOMagic
How do you get SEO working when you get tricked in to making an SPA? Magic.
Installation
Usage
Configuration
Need to change some of the default settings?
fetchPage(string $uri, bool $fresh = false)
fetchPage()
will return a PageResponse
object containing the HTML content of the requested URI.
Pages are cached for 24 hours by default, but this is customisable through the variable redis_cache_default_ttl
.
Setting $fresh
to true will force a fresh copy of the page. Beware though, this isn't the fastest thing in the world.
cachePage(string $uri)
cachePage()
will store the requested URI in the cache. This is useful for preemptively storing the page in the cache to speed up results of legitimate page requests.
Response Object
This is the object that will be returned from the fetchPage()
function and is used internally to store the page response.
getHtml(): string
This will return a string that contains the HTML content of the page (without scripts or style tags). This is the bread and butter of the response.
getHeaders(): array
This will return an array of all of the headers.
getResponseCode(): int
This will return the response code of the request.
getRenderTime(): float
This returns a float that represents the time it took to render the page. This is mainly for performance metrics.
isFromCache(): bool
This returns a boolean that states whether or not the page is being fetched from the cache or not. This can be used to check whether your caching system is working correctly and how many hits/misses you are getting.
All versions of seo-magic with dependencies
monolog/monolog Version ^1.24
guzzlehttp/guzzle Version ^6.3
nesk/puphpeteer Version ^1.6
paquettg/php-html-parser Version ^2.0