bickmista/spurl
最新稳定版本:0.3.1
Composer 安装命令:
composer require bickmista/spurl
包简介
A URL library that can validate, modify and split URL's. This library can split URL's into Subdomain, domain and TLD without choking when it comes to newer TLD's.
关键字:
README 文档
README
A URL manipulation library
Description
A PHP Library that can break down and build URLs into/from an array.
##Implementations
Current
- Breakdown URLs
- Build up URLs
Planned
- Replace segments before build
- Shuffle segments before build (e.g. swap host.domain with path.2)
Requirements
- PHP 5.4+
Installation
Using Composer
To install Spurl with Composer, just add the following to your composer.json file
{
"require": {
"bickmista/spurl": "0.*"
}
}
or by running the following command:
composer require bickmista/spurl
Usage
General
Shatter
To break down a URL into segments pass it into our shatter function.
$url = 'http://test.com/example/path?some=query#anchor'; $splitUrl = Spurl\Url::shatter($url);
The output from the shatter function in the example above would be
$splitUrl = [ 'protocol' => 'http', 'host' => 'test.com', 'path' => 'example/path', 'query' => 'some=query', 'anchor' => 'anchor' ];
You can also break down URLs further by passing true as an optional second parameter
$url = 'http://test.com/'; $splitUrl = Spurl\Url::shatter($url, true);
which would return
$splitUrl = [ 'protocol' => 'http', 'host' => [ 'domain' => 'test', 'suffix' => 'com' ] ];
统计信息
- 总下载量: 3.6k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-08-12