定制 romeoz/rock-url 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

romeoz/rock-url

最新稳定版本:0.12.1

Composer 安装命令:

composer require romeoz/rock-url

包简介

A simple PHP library to parse and builder URLs

README 文档

README

Latest Stable Version Total Downloads Build Status HHVM Status Coverage Status License

Installation

From the Command Line:

composer require romeoz/rock-url

In your composer.json:

{
    "require": {
        "romeoz/rock-url": "*"
    }
}

Quick Start

use rock\url\Url;

// example URL: http://site.com/foo/?page=1

// returns relative URL
(new Url)->getRelative(); // output: /foo/?page=1

// modify URL
Url::set('https://site.com/?page=2#name')->removeFragment()->getRelative(); 
//output: /?page=2

Url::set('https://site.com/?page=2#name')->removeQueryParams(['page'])->getAbsolute(); 
//output: https://site.com/#name

###Short method modify()

Url::modify(['https://site.com/', 'foo' => 'test', '#' => 'name']);
//output: /?foo=test#name

Url::modify(['https://site.com/?foo=test#name', '!foo', '!#', '@scheme' => Url::ABS]);
//output: https://site.com/

// modify current url
Url::modify([foo' => 'test]);
//output: /?foo=test

Requirements

  • PHP 5.4+
  • For generating CSRF-token (security) required Rock CSRF: composer require romeoz/rock-csrf

All unbolded dependencies is optional

License

Rock URL library is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 1.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-30