https://github.com/willwashburn/mushroom
:mushroom: expand links to their final destination
https://github.com/willwashburn/mushroom
bitly expanding-shortened-urls php shorten-urls shortener tinyurl url-shortener
Last synced: about 1 year ago
JSON representation
:mushroom: expand links to their final destination
- Host: GitHub
- URL: https://github.com/willwashburn/mushroom
- Owner: willwashburn
- License: mit
- Created: 2015-06-08T20:20:14.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2019-11-19T19:11:39.000Z (over 6 years ago)
- Last Synced: 2024-04-14T14:52:10.440Z (about 2 years ago)
- Topics: bitly, expanding-shortened-urls, php, shorten-urls, shortener, tinyurl, url-shortener
- Language: PHP
- Homepage:
- Size: 57.6 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Mushroom :mushroom:  [](https://coveralls.io/github/willwashburn/mushroom) [](https://packagist.org/packages/willwashburn/mushroom) [](https://packagist.org/packages/willwashburn/mushroom) [](https://github.com/willwashburn/mushroom/blob/master/LICENSE)
Expand a link.
Mushroom finds the final destination of a shortened (or not shortened) url.
> Note: Not for psychedelic drug use
## Usage
```PHP
$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