axy/fs-paths

文件系统路径操作

0.1.1 2015-11-23 06:56 UTC

This package is auto-updated.

Last update: 2024-09-08 02:16:10 UTC


README

文件系统路径操作。

Latest Stable Version Minimum PHP Version Build Status Coverage Status License

  • 该库不依赖任何其他依赖(除了composer包)。
  • 测试于PHP 5.4+、PHP 7、HHVM(在Linux上)、PHP 5.5(在Windows上)。
  • 安装:composer require axy/fs-paths
  • 许可协议:MIT

文档

该库提供了处理文件路径的函数。包括规范化、解析等。

该库使用抽象路径。不对真实文件系统进行请求。

内容

示例

use axy\fs\paths\Paths;

/* Static methods */
Paths::normalize('/one/two/../three'); // "/one/three"

/* Adapters */
$posix = Paths::getAdapter('posix');
$win = Paths::getAdapter('windows');

$posix->isAbsolute('c:\config.sys'); // False
$win->isAbsolute('c:\config.sys'); // True

/* Objects */
$url = Paths::getAdapter('url')->create('http://site.loc/news/view.php?id=10');
$url->resolve('../index.html#footer'); // http://site.loc/index.html#footer

$url->params->fragment; // "footer"