sunkan/actus
Composer 安装命令:
composer require sunkan/actus
包简介
PHP virtual path library
README 文档
README
This is a fork of https://github.com/JBZoo/Path. I needed it to be easy to configure with DI
Virtual file system
How to use
require_once './vendor/autoload.php'; // composer autoload.php
// Get needed classes.
use Actus\Path;
// Get path instance.
$path = new Path();
// Setup root directory.
$path->setRoot(__DIR__);
// Set multiple aliases
$path->setAliases([
'less' => [
__DIR__ . 'styles/folder/less',
__DIR__ . 'theme/styles/less',
],
'css' => [
__DIR__ . 'styles/folder/css',
__DIR__ . 'theme/styles/css',
]
]);
// Add paths.
$path->add(__DIR__ . '/styles/css', 'css');
$path->add(__DIR__ . '/simple/styles/css', 'css');
// Add array paths.
$path->add(array(
__DIR__ . 'styles/folder/less',
__DIR__ . 'theme/styles/less',
), 'less');
/**
* Add paths by virtual.
* If you already added at least one one way, you can use the virtual paths
*/
$path->add('less:assets/less');
$path->add('css:assets/less');
// Get added path list by key.
var_dump($path->getPaths('css:'));
var_dump($path->getPaths('less:'));
/**
* Get full path for the first file found, if file exits.
*/
echo $path->get('css:styles.css'); // result: C:/Server/jbzoo/styles/css/styles.css
echo $path->get('less:path/to/styles.less'); // result: C:/Server/jbzoo/styles/folder/less/path/to/styles.less
/**
* Get url for the first file found, if file exits.
* If - "C:/Server/jbzoo" is root dir we have...
*/
$path->url('css:styles.css'); // http://my-site.com/styles/css/styles.css
$path->url('less:path/to/styles.less') // http://my-site.com/styles/css/folder/less/path/to/styles.less
echo '<link rel="stylesheet" href="' . $path->url('css:styles.css') . '">';
/**
* Need remove added path?
* Second parameter is the key of the paths array.
*/
$path->remove('less:', array(1));
// or use string
$path->remove('less:', 1);
// Clean path.
$path->clean('C:\server/folder\\\file.txt'); // result: 'C:/server/folder/file.txt'
$path->clean('path\\to//simple\\folder') // result: 'path/to/simple/folder'
sunkan/actus 适用场景与选型建议
sunkan/actus 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6.38k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2016 年 03 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 sunkan/actus 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sunkan/actus 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 6.38k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 4
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2016-03-16