Expand a link.

Mushroom finds the final destination of a shortened (or not shortened) url.

Code Quality Rank: L4
Monthly Downloads: 40
Programming language: PHP
License: MIT License
Latest version: v2.11.0

Mushroom alternatives and similar libraries

Based on the "URL" category

Do you think we are missing an alternative of Mushroom or a related project?

Add another 'URL' Library


Mushroom :mushroom: CircleCI (all branches) Coveralls Packagist Packagist MIT License

Expand a link.

Mushroom finds the final destination of a shortened (or not shortened) url.

Note: Not for psychedelic drug use


 $mushroom = new Mushroom\Mushroom();

 /// With a single bitly link
 //// http://www.yourlink.com

 /// With an array of links
 /// array http://somebitlylink.com, http://somegooglelink.com, http://somefulllink.com/foo

 // Find the canonical url of some link (or set of links)
 // http://www.yourlink.com


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

*Note that all licence references and agreements mentioned in the Mushroom README section above are relevant to that project's source code only.