bitandblack/pathinfo
最新稳定版本:1.0.4
Composer 安装命令:
composer require bitandblack/pathinfo
包简介
Easy handling of path information in an object-oriented way.
README 文档
README
Bit&Black PathInfo
Easy handling of path information in an object-oriented way.
Installation
This library is made for the use with Composer. Add it to your project by running $ composer require bitandblack/pathinfo.
Usage
Initialize the PathInfo with a path:
<?php
use BitAndBlack\PathInfo\PathInfo;
$pathInfo = new PathInfo('/path/to/myfile.jpg');
You can access the single parts of the path now like that:
<?php
/** Will echo "myfile" */
echo $pathInfo->getFileName();
/** Will echo "jpg" */
echo $pathInfo->getExtension();
You can also modify the parts:
<?php
use BitAndBlack\PathInfo\PathInfo;
$pathInfo = new PathInfo('/path/to/myfile.jpg');
/** Will echo "/path/to/myfile.jpg" */
echo $pathInfo->getFilePath();
$pathInfoModified = $pathInfo
->withFileNameAppended('-modified')
->withExtension('png')
;
/** Will echo "/path/to/myfile-modified.png" */
echo $pathInfoModified->getFilePath();
Help
If you have any questions, feel free to contact us under hello@bitandblack.com.
Further information about Bit&Black can be found under www.bitandblack.com.
统计信息
- 总下载量: 8.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 9
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-05-11