fyre/uri 问题修复 & 功能扩展

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

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

fyre/uri

Composer 安装命令:

composer require fyre/uri

包简介

A URI library.

README 文档

README

FyreURI is a free, open-source immutable URI library for PHP.

Table Of Contents

Installation

Using Composer

composer require fyre/uri

In PHP:

use Fyre\Http\Uri;

Basic Usage

  • $uriString is a string representing the uri.
$uri = new Uri($uriString);

Alternatively, you can use the createFromString method for easier chaining.

$uri = Uri::createFromString($uriString);

Methods

Get Authority

Get the URI authority string.

$authority = $uri->getAuthority();

Get Fragment

Get the URI fragment.

$fragment = $uri->getFragment();

Get Host

Get the URI host.

$host = $uri->getHost();

Get Path

Get the URI path.

$path = $uri->getPath();

Get Port

Get the URI port.

$port = $uri->getPort();

Get Query

Get the URI query string.

$query = $uri->getQuery();

Get Query Params

Get the URI query params.

$params = $uri->getQueryParams();

Get Scheme

Get the URI scheme.

$scheme = $uri->getScheme();

Get Segment

Get a specified URI segment.

  • $segment is a number indicating the segment index.
$part = $uri->getSegment($segment);

Get Segments

Get the URI segments.

$segments = $uri->getSegments();

Get Total Segments

Get the URI segments count.

$segmentCount = $uri->getTotalSegments();

Get Uri

Get the URI string.

$uriString = $uri->getUri();

Get User Info

Get the user info string.

$userInfo = $uri->getUserInfo();

Resolve Relative Uri

Clone the Uri with a resolved relative URI.

  • $relativeUri is a string representing the relative uri.
$newUri = $uri->resolveRelativeUri($relativeUri);

With Added Query

Clone the Uri with a new query parameter.

  • $key is a string representing the query key.
  • $value is the query value.
$newUri = $uri->withAddedQuery($key, $value);

With Authority

Clone the Uri with a new authority.

  • $authority is a string representing the authority.
$newUri = $uri->withAuthority($authority);

With Fragment

Clone the Uri with a new fragment.

  • $fragment is a string representing the fragment.
$newUri = $uri->withFragment($fragment);

With Host

Clone the Uri with a new host.

  • $host is a string representing the host.
$newUri = $uri->withHost($host);

With Only Query

Clone the Uri with only specific query parameters.

  • $keys is an array containing the query parameters to keep.
$newUri = $uri->withOnlyQuery($keys);

Without Query

Clone the Uri without query parameters.

  • $keys is an array containing the query parameters to remove.
$newUri = $uri->withoutQuery($keys);

With Path

Clone the Uri with a new path.

  • $path is a string representing the path.
$newUri = $uri->withPath($path);

With Port

Clone the Uri with a new port.

  • $port is a number representing the port.
$newUri = $uri->withPort($port);

With Query

Clone the Uri with a new query string.

  • $query is a string representing the query parameters.
$newUri = $uri->withQuery($query);

With Query Params

Clone the Uri with new query parameters.

  • $params is an array containing the query parameters.
$newUri = $uri->withQueryParams($params);

With Scheme

Clone the Uri with a new scheme.

  • $scheme is a string representing the scheme.
$newUri = $uri->withScheme($scheme);

With User Info

Clone the Uri with new user info.

  • $username is a string representing the username.
  • $password is a string representing the password, and will default to null.
$newUri = $uri->withUserInfo($username, $password);

fyre/uri 适用场景与选型建议

fyre/uri 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 407 次下载、GitHub Stars 达 0, 最近一次更新时间为 2021 年 12 月 01 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 fyre/uri 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 fyre/uri 我们能提供哪些服务?
定制开发 / 二次开发

基于 fyre/uri 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 407
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 3
  • 推荐数: 0

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-01