Via Composer
$ composer require rhincodon/utm-url-parser
$utmUrl = 'http://test.com/test?utm_source=bing&&utm_medium=cpc&utm_campaign=rolex&utm_term=rolex+two';
$parser = new \Rhinodontypicus\Parsers\UtmParser();
$utmString = $parser->parse($utmUrl);
if ($utmString->isValid()) { // true
echo $utmString->source; // bing
echo $utmString->medium; // cpc
echo $utmString->campaign; // rolex
echo $utmString->term; // rolex two
}
The MIT License (MIT). Please see License File for more information.