承接 arc/base 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

arc/base

最新稳定版本:3.0.4

Composer 安装命令:

composer require arc/base

包简介

Ariadne Component Library

README 文档

README

Scrutinizer Code Quality Code Coverage Latest Stable Version Total Downloads Latest Unstable Version License

arc\base is part of ARC - a component library. This package provides a number of basic datatypes and operations that are used in most other ARC packages.

ARC is a spinoff from the Ariadne Web Application Platform and Content Management System http://www.ariadne-cms.org/.

Installation

You can install the full set of ARC components using composer:

composer require arc/arc

Or you can start a new project with arc/arc like this:

composer create-project arc/arc {$path}

Or just use this package:

composer require arc/base

arc/base contains

  • path: parse paths, including relative paths, get parents, etc.
  • tree: methods to parse filesystem-like trees and search and alter them
  • hash: methods to ease common tasks with nested hashes
  • template: simple php based templates, with compile option
  • context: nested scope or stackable DI container
  • lambda: partial function application

Example code

\arc\path

\arc\path::collapse( '../', '/current/directory/' );
// => '/current/'

\arc\path::collapse( 'some//../where', '/current/directory' );
// => '/current/directory/where/'

\arc\path::collapse( '../../../', '/current/directory/' );
// => '/'

\arc\path::diff( '/a/b/', '/a/c/' );
// => '../c/'

\arc\path::parent( '/parent/child/' );
// => '/parent/'

\arc\path::map( '/some path/with "quotes"/', function( $entry ) {
    return urlencode( $entry, ENT_QUOTES );
});
// => '/some+path/with+%22quotes%22/'

\arc\path::reduce( '/a/b/', function( $result, $entry ) {
    return $result . $entry . '\\';
}, '\\' );
// => '\\a\\b\\';

\arc\tree

$tree = \arc\tree::expand([
    '/' => 'Root',
    '/foo/bar/' => 'Bar'
]);
// => NamedNode tree with '/' => Root, '/foo/' => null, '/foo/bar/' => 'Bar'

$hash = \arc\tree::collapse( $tree );
// [ '/' => 'Root', '/foo/bar/' => 'Bar' ]

$nodeValueWithAnR = \arc\tree::search( $tree, function($node) {
    if ( strpos( $node->nodeValue, 'R' )!==false ) {
        return $node->nodeValue;
    }
});
// => 'Root'

$Btree = \arc\tree::filter( $tree, function($node) {
    return ( strpos( $node->nodeValue, 'B' ) !== false );
});
// => [ '/foo/bar/' => 'Bar' ]

\arc\hash

\arc\hash::get( '/foo/bar/', [ 'foo' => [ 'bar' => 'baz' ] ] );
// => 'baz'

\arc\hash::get( '/foo/bar/', [ 'foo' => [  ] ], 'zilch' );
// => 'zilch'

\arc\hash::parseName( 'input[one]' );
// => '/input/one/'

\arc\hash::compileName( '/input/one' );
// => 'input[one]'

\arc\tree::collapse(
    \arc\hash::tree(
        [ 'foo' => [ 'bar' => 'A bar', 'baz' => 'Not a bar' ] ]
    )
);
// => [ '/foo/bar/' => 'A bar', '/foo/baz/' => 'Not a bar' ]

统计信息

  • 总下载量: 30.2k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 9
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-06-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固