PHP code example of willwashburn / mushroom

1. Go to this page and download the library: Download willwashburn/mushroom library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

willwashburn / mushroom example snippets


 $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