bjoern-goetschke/psr7-base-url
Composer 安装命令:
composer require bjoern-goetschke/psr7-base-url
包简介
PSR7 request base url library
README 文档
README
This library provides the class BjoernGoetschke\Psr7BaseUrl\BaseUrlExtractor to find the base url,
base path and uri path of a Psr\Http\Message\ServerRequestInterface request.
Basic usage
/** @var \Psr\Http\Message\ServerRequestInterface $request */
// Request URL: http://www.example.com/some-folder/another-folder/something
// The request has been redirected using rewrite rules to this file: http://www.example.com/some-folder/index.php
$baseUrlExtractor = \BjoernGoetschke\Psr7BaseUrl\BaseUrlExtractor($request);
// `$baseUrl` will contain 'http://www.example.com/some-folder'
$baseUrl = $baseUrlExtractor->baseUrl();
// `$basePath` will contain '/some-folder'
$basePath = $baseUrlExtractor->basePath();
// `$uriPath` will contain '/another-folder/something'
$uriPath = $baseUrlExtractor->uriPath();
Installation
The library is available via Composer:
composer require bjoern-goetschke/psr7-base-url:^3.0
Versioning
Releases will be numbered with the following format using semantic versioning:
<major>.<minor>.<patch>
And constructed with the following guidelines:
- Breaking backwards compatibility bumps the major
- New additions without breaking backwards compatibility bumps the minor
- Bug fixes and misc changes bump the patch
For more information on semantic versioning, please visit http://semver.org/.
LICENSE
The library is released under the BSD-2-Clause license. You can find a copy of this license in LICENSE.txt.
API usage and backwards compatibility
Information about the intended usage of interfaces, classes, methods, etc. is specified with the @api tag.
If an element does not contain the @api tag it should be considered internal and usage may break at any time.
One exception to this rule are special elements like constructors, destructors or other hook methods that are defined
by the programming language. These elements will not have their own @api tag but can be considered as if they have
the same @api tag as the class or whatever other element they belong to.
The library DOES NOT provide a backwards-compatibility promise for parameter names. Methods will have the
@no-named-arguments tag to help static analysis tools in detecting and warning about using the library with
named arguments, but in case it is missing somewhere that does not mean that a backwards-compatibility promise
is given for that specific method.
@api usage
- Classes
- Create new instances of the class
- may break on
major-releases
- may break on
- Extending the class and adding a new constructor
- may break on
major-releases
- may break on
- Extending the class and adding new methods
- may break at any time, but
minor-releases should be ok most of the time (will break if a non-private method has been added to the base class that was also declared in the extending class)
- may break at any time, but
- Create new instances of the class
- Methods
- Calling the method
- may break on
major-releases
- may break on
- Overriding the method (extending the class and declaring a method with the same name) and eventually
adding additional optional arguments
- may break at any time, but
minor-releases should be ok most of the time (will break if an optional argument has been added to the method in the base-class)
- may break at any time, but
- Calling the method
- Interfaces
- Using the interface in type-hints (require an instance of the interface as argument)
- may break on
major-releases
- may break on
- Calling methods of the interface
- may break on
major-releases
- may break on
- Implementing the interface
- may break at any time, but
minor-releases should be ok most of the time (will break if new methods have been added to the interface)
- may break at any time, but
- Extending the interface
- may break at any time, but
minor-releases should be ok most of the time (will break if a method has been added to the base interface that was also declared in the extending interface)
- may break at any time, but
- Using the interface in type-hints (require an instance of the interface as argument)
@api extend
- Classes
- Create new instances of the class
- may break on
major-releases
- may break on
- Extending the class and adding a new constructor
- may break on
major-releases
- may break on
- Extending the class and adding new methods
- may break on
minor-releases, but it should be ok most of the time and may only break onmajor-releases (will break if a non-private method has been added to the base class that was also declared in the extending class)
- may break on
- Create new instances of the class
- Methods
- Calling the method
- may break on
major-releases
- may break on
- Overriding the method (extending the class and declaring a method with the same name) and eventually
adding additional optional arguments
- may break on
major-releases
- may break on
- Calling the method
- Interfaces
- Using the interface in type-hints (require an instance of the interface as argument)
- may break on
major-releases
- may break on
- Calling methods of the interface
- may break on
major-releases
- may break on
- Implementing the interface
- may break on
major-releases
- may break on
- Extending the interface
- may break on
major-releases
- may break on
- Using the interface in type-hints (require an instance of the interface as argument)
@api stable
- Everything that is marked as stable may only break on
major-releases, this means that except some minor internal changes or bugfixes the code will just never change at all
@api internal
- Everything that is marked as internal may break at any time, but
patch-releases should be ok most of the time
bjoern-goetschke/psr7-base-url 适用场景与选型建议
bjoern-goetschke/psr7-base-url 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.64k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2017 年 09 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「middleware」 「psr-7」 「psr7」 「base url」 「baseurl」 「psr-15」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 bjoern-goetschke/psr7-base-url 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 bjoern-goetschke/psr7-base-url 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 bjoern-goetschke/psr7-base-url 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Shoot aims to make providing data to your templates more manageable
Model of a web-based resource
Interfaces for web resource models and services to retrieve and create them
Skolkovo API Client
Interface for a factory to create Psr\Http\Message\StreamInterface objects
A PSR-7 compatible library for making CRUD API endpoints
统计信息
- 总下载量: 4.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2017-09-20