PHPackages                             willwashburn/mushroom - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. willwashburn/mushroom

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

willwashburn/mushroom
=====================

expand links to their final destination

v2.11.0(6y ago)684.1k↓38.2%1MITPHPPHP &gt;=5.5.0CI failing

Since Jun 15Pushed 6y ago3 watchersCompare

[ Source](https://github.com/willwashburn/mushroom)[ Packagist](https://packagist.org/packages/willwashburn/mushroom)[ Docs](https://github.com/willwashburn/mushroom)[ RSS](/packages/willwashburn-mushroom/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (5)Versions (20)Used By (0)

Mushroom 🍄 [![CircleCI (all branches)](https://camo.githubusercontent.com/ecd434fcf3dea0e5d67063913455f2842919e6c07814d2430d891e8e0bb3d685/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f70726f6a6563742f6769746875622f77696c6c776173686275726e2f6d757368726f6f6d2e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/ecd434fcf3dea0e5d67063913455f2842919e6c07814d2430d891e8e0bb3d685/68747470733a2f2f696d672e736869656c64732e696f2f636972636c6563692f70726f6a6563742f6769746875622f77696c6c776173686275726e2f6d757368726f6f6d2e7376673f7374796c653d666c61742d737175617265) [![Coveralls](https://camo.githubusercontent.com/f584f45b1c9a04f9435a955ed8a2b42f1d3908a36d78362af80675ecb0cc4f88/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f77696c6c776173686275726e2f6d757368726f6f6d2e7376673f6d61784167653d32353932303030267374796c653d666c61742d737175617265)](https://coveralls.io/github/willwashburn/mushroom) [![Packagist](https://camo.githubusercontent.com/ed06e05b3363e697c27ac3ddb2d33acf5d0aed7d781ceee7350acde7e686ab2e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f77696c6c776173686275726e2f6d757368726f6f6d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/willwashburn/mushroom) [![Packagist](https://camo.githubusercontent.com/a34e541185ab36f7699ae6e19ff2fec6dd8fd4a8d4e05632fff8bc00a4afec50/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f77696c6c776173686275726e2f6d757368726f6f6d2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/willwashburn/mushroom) [![MIT License](https://camo.githubusercontent.com/a16ad14f24a1778622a58268f2f103815251bd9496ed7c29aa052a439b546ebf/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f77696c6c776173686275726e2f6d757368726f6f6d2e7376673f7374796c653d666c61742d737175617265)](https://github.com/willwashburn/mushroom/blob/master/LICENSE)
==========================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#mushroom-mushroom-----)

Expand a link.

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

> Note: Not for psychedelic drug use

Usage
-----

[](#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
------------

[](#installation)

Use composer

`composer require willwashburn/mushroom`

Alternatively, add `"willwashburn/mushroom": "~2.11"` to your composer.json

Change Log
----------

[](#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
------------

[](#future-plans)

- "Polite" mode to use common link shortening services api's to not count expanding in click counts

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 96.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~90 days

Recently: every ~56 days

Total

19

Last Release

2419d ago

Major Versions

v0.0.2 → v1.02016-03-04

v1.1.0 → v2.0.02016-04-07

PHP version history (2 changes)v0.0.1PHP &gt;=5.4.0

v2.9.0PHP &gt;=5.5.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/957608?v=4)[Will Washburn](/maintainers/willwashburn)[@willwashburn](https://github.com/willwashburn)

---

Top Contributors

[![willwashburn](https://avatars.githubusercontent.com/u/957608?v=4)](https://github.com/willwashburn "willwashburn (49 commits)")[![atopiler](https://avatars.githubusercontent.com/u/742502?v=4)](https://github.com/atopiler "atopiler (1 commits)")[![irazasyed](https://avatars.githubusercontent.com/u/1915268?v=4)](https://github.com/irazasyed "irazasyed (1 commits)")

---

Tags

bitlyexpanding-shortened-urlsphpshorten-urlsshortenertinyurlurl-shortenerurllinkbitlyresolveresolverexpandunshortenexpand linkunshorten linkexpand bitlyexpand urlunshorten urlresolve url

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/willwashburn-mushroom/health.svg)

```
[![Health](https://phpackages.com/badges/willwashburn-mushroom/health.svg)](https://phpackages.com/packages/willwashburn-mushroom)
```

###  Alternatives

[yourls/yourls

Your Own URL Shortener

12.1k27.9k2](/packages/yourls-yourls)[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6758.1M80](/packages/jbroadway-urlify)[shivella/laravel-bitly

Laravel package for generating bitly url

75867.0k1](/packages/shivella-laravel-bitly)[mattwright/urlresolver

PHP class that attempts to resolve URLs to a final, canonical link.

66183.6k](/packages/mattwright-urlresolver)[misd/linkify

Converts URLs and email addresses in text into HTML links

1163.2M12](/packages/misd-linkify)[voku/urlify

PHP port of URLify.js from the Django project. Transliterates non-ascii characters for use in URLs.

274.2M8](/packages/voku-urlify)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
