arokettu/path

路径操作库

2.0.3 2024-07-28 20:00 UTC

This package is auto-updated.

Last update: 2024-08-28 20:09:33 UTC


README

Packagist PHP License Gitlab pipeline status Codecov

一个用于处理绝对和相对路径的PHP库。

安装

composer require arokettu/path

使用

<?php

use Arokettu\Path\PathUtils;
use Arokettu\Path\RelativePath;
use Arokettu\Path\UrlPath;

// simple interface

PathUtils::resolveRelativePath('/some/path', '../other/path');
// => /some/other/path
PathUtils::makeRelativePath('/some/path', '/some/other/path');
// => ../other/path

// OOP interface, more control

$url = UrlPath::parse('https://example.com/some/path');
$rel = RelativePath::unix('../other/path');
$url->resolveRelative($rel)->toString();
// => https://example.com/some/other/path

文档

在这里阅读完整文档: https://sandfox.dev/php/path.html

也可在Read the Docs上找到: https://php-path.readthedocs.io/

支持

请在我们的GitLab主仓库中提交问题: https://gitlab.com/sandfox/path/-/issues

欢迎在Gitter的房间中提出任何问题: https://gitter.im/arokettu/community

许可证

该库在MIT许可证的条款下作为开源软件提供。MIT License.