mingalevme/http-build-url 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

mingalevme/http-build-url

最新稳定版本:1.0.5

Composer 安装命令:

composer require mingalevme/http-build-url

包简介

Advanced version of http_build_url

关键字:

README 文档

README

Advanced version of http_build_url

Travis CI

Build Status

Codecov

codecov

Installation

  1. composer require mingalevme/http-build-url.

  2. Now you are able to use the tool:

<?php

echo build_url('//github.com/mingalevme/http-build-url', [
    's' => 'https', // s (scheme): set scheme only if not presented
]); // https://github.com/mingalevme/http-build-url

echo build_url('http://github.com/mingalevme/http-build-url', [
    'S' => 'https', // S (SCHEME): force set scheme
]); // https://github.com/mingalevme/http-build-url

echo build_url('https://github.com/mingalevme/http-build-url', [
    'h' => 'bitbucket.org', // h (host): set host only if not presented
]); // https://github.com/mingalevme/http-build-url

echo build_url('https://github.com/mingalevme/http-build-url', [
    'H' => 'bitbucket.org', // H (HOST): force set host
]); // https://bitbucket.org/mingalevme/http-build-url

Usage

/**
 * Build an URL
 *
 * @param string|array $url Base url or parts of the url (aliases is not supported), to build from scratch use any falsy value, e.g. [], null or ''
 * @param array $replacement [optional] Associative array like parse_url() returns
 * @param array &$newUrlParts [optional] If set, it will be filled with the parts of the composed url like parse_url() would return
 * @return string The new URL string
 */
Mingalevme\HttpBuildUrl\HttpBuildUrl::build(string|array $url, array $replacement=[], array &$newUrlParts=null)

Aliases

/**
 * "p" is not used to not confusing between port, path, password;
 * use fully qualified name
 */
[
    'u' => 'user',
    's' => 'scheme',
    'h' => 'host',
    'q' => 'query',
    'f' => 'fragment',
]

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-05-15