Makes the algorithms and APIs defined by URL Standard (replaces RFC 3986 and RFC 3987) available on PHP. / URL Standard (RFC 3986、RFC 3987 を置き換える Web 標準仕様) で定義されているアルゴリズム、および API を PHP から利用できるようにします。

资助包维护!
esperecyan

v5.3.1 2023-02-15 04:51 UTC

README

英文 / 日语

URL Standard

Makes the algorithms and APIs defined by URL Standard available on PHP.

描述

URL Standard is the Web standard specification that replaces the previous standards RFC 3986 and RFC 3987.

The specification defines URL interface and URLSearchPrams interface as API. This library allows you to use esperecyan\url\URL class as URL interface and esperecyan\url\URLSearchParams class as URLSearchPrams interface. The documents on MDN may be easy to understand by way of explanation of the interfaces https://mdn.org.cn/docs/Web/API/URL https://mdn.org.cn/docs/Web/API/URLSearchParams .

This library allows you to use the algorithms defined by URL Standard. For details, see The correspondence table of the algorithms.

示例

<?php
require_once 'vendor/autoload.php';

use esperecyan\url\URL;

$url = new URL('http://url.test/foobar?name=value');
var_dump($url->protocol, $url->pathname, $url->searchParams->get('name'));

The above example will output

string(5) "http:"
string(7) "/foobar"
string(5) "value"

需求

  • PHP 5.4, or 7.2 or later (PHP 5.4 and 7.2 are deprecated)
    • SPL Types PECL library is not supported

安装

composer require esperecyan/url

For help with installation of Composer, see Composer documentation.

贡献

  1. Fork it ( https://github.com/esperecyan/url )
  2. Create your feature branch git checkout -b my-new-feature
  3. Commit your changes git commit -am 'Add some feature'
  4. Push to the branch git push origin my-new-feature
  5. Create new Pull Request

Or

Create new Issue

If you find any mistakes of English in the README or Doc comments or any flaws in tests, please report by such as above means. I also welcome translations of README too.

致谢

I use the code from コードポイントから UTF-8 の文字を生成する - Qiita and UTF-8 の文字からコードポイントを求める - Qiita in implementing URLencoding class.

I use URL Standard (Japanese translation) as reference in creating this library.

HADAA帮助我将README翻译成英文。

语义化版本控制

本库使用语义化版本控制。库中的类、方法、常量和属性,在库文档中,是公开API。

许可证

本库遵循Mozilla Public License Version 2.0 (MPL-2.0)许可证。

算法对应表