codezero / utilities
All-round utilities library
Installs: 36 931
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.4.0
Requires (Dev)
- phpspec/phpspec: ~2.0
This package is auto-updated.
Last update: 2020-02-11 01:37:22 UTC
README
This package includes some all-round methods that might be useful in many projects.
Installation
Download this package or install it through Composer:
"require": {
"codezero/utilities": "1.*"
}
URL Helper
Join slugs into a well formatted URL
$urlParts = [
'http://www.mysite.com/',
'/subdir',
'someOtherDir/',
'/somepage.php'
];
use CodeZero\Utilities\UrlHelper;
$urlHelper = new UrlHelper();
$url = $urlHelper->joinSlugs($urlParts);
Returns:
http://www.mysite.com/subdir/someOtherDir/somepage.php
This will make sure there is only one slash between each slug.