willwashburn / mushroom
expand links to their final destination
Installs: 66 930
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=5.5.0
- ext-curl: *
- willwashburn/canonical: ~3
- willwashburn/curl: ~1
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ~4.0
- squizlabs/php_codesniffer: 3.*
README
Expand a link.
Mushroom finds the final destination of a shortened (or not shortened) url.
Note: Not for psychedelic drug use
Usage
$mushroom = new Mushroom\Mushroom(); /// With a single bitly link $mushroom->expand('bit.ly/xwzfs'); //// http://www.yourlink.com /// With an array of links $mushroom->expand(['bit.ly/1asdf','goog.it/sdfsd','somefulllink.com/foo']); /// array http://somebitlylink.com, http://somegooglelink.com, http://somefulllink.com/foo // Find the canonical url of some link (or set of links) $mushroom->canonical('http://yourlink.com?utm_param=mushroom'); // http://www.yourlink.com
Installation
Use composer
composer require willwashburn/mushroom
Alternatively, add "willwashburn/mushroom": "~2.11"
to your composer.json
Change Log
- v2.11.0 - Expose HttpStatusCode for urls when searching canonically
- v2.10.0 - Add method to add a domain to JS Redirect Domains array
- v2.9.1 - Fix bug where some html sources were not cached
- v2.9.0 - Expose HTML for urls when searching canonically
- v2.8.0 - Only follow JS redirects for whitelisted domains
- v2.7.0 - Follow some JS redirects
- v2.6.0 - Add default timeout to curl options
- v2.5.1 - Add spoofed browser headers to default curl opts
- v2.5.0 - Ensure that http-refresh redirects have host and scheme
- v2.4.0 - Follow http-refresh html meta tags
- v2.3.0 - Ensure that canonical urls have a host
- v2.2.0 - Ensure that canonical urls have a scheme
- v2.1.1 - Remove CURLOPT_NOBODY from defaults
- v2.1.0 - Allow setting curl handle options; set user agent as default
- v2.0.0 - Stop removing slashes from the end of urls
- v1.1.0 - Add ability to find canonical url from tags in body of returned page
- v1.0.0 - Expand multiple links using multi_curl_* for faster responses
- v0.0.2 - Basic link expanding using curl
- v0.0.1 - Basic link expanding using "get_headers"
Future Plans
- "Polite" mode to use common link shortening services api's to not count expanding in click counts