PHPackages                             arc/base - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. arc/base

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

arc/base
========

Ariadne Component Library

3.0.4(2mo ago)129.9k↑133.3%39MITPHPPHP &gt;=7.1

Since Jun 20Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/Ariadne-CMS/arc-base)[ Packagist](https://packagist.org/packages/arc/base)[ Docs](https://github.com/Ariadne-CMS/arc/wiki)[ RSS](/packages/arc-base/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (4)Versions (13)Used By (9)

arc\\base common datatypes for ARC
==================================

[](#arcbase-common-datatypes-for-arc)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1c362352b02ced730066d96899f6435a189a82f7699d760551630e2e764c7262/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f41726961646e652d434d532f6172632d626173652f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Ariadne-CMS/arc-base/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/023ef3ffd9017f4391d452a8196f70195cd8ff56a85472e5524b156abd932a00/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f41726961646e652d434d532f6172632d626173652f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/Ariadne-CMS/arc-base/)[![Latest Stable Version](https://camo.githubusercontent.com/f96ed4c6210498d2fcd14c55f24bcc25e38eedb79c4f4221636fa8e76980f447/68747470733a2f2f706f7365722e707567782e6f72672f6172632f626173652f762f737461626c652e737667)](https://packagist.org/packages/arc/base)[![Total Downloads](https://camo.githubusercontent.com/7a4793566752837aa427f06a4f39352b8a2d6c17b78270a3c2c47266d96f6df7/68747470733a2f2f706f7365722e707567782e6f72672f6172632f626173652f646f776e6c6f6164732e737667)](https://packagist.org/packages/arc/base)[![Latest Unstable Version](https://camo.githubusercontent.com/cbdef8b3e91c3ded0ed2ca5a4caae0950388db5f1e4d1bc10452fa2ebe2c6404/68747470733a2f2f706f7365722e707567782e6f72672f6172632f626173652f762f756e737461626c652e737667)](https://packagist.org/packages/arc/base)[![License](https://camo.githubusercontent.com/7c0adc5889e93251646ed9126e89205d209856bd2162853bd48af59c6ae00bb3/68747470733a2f2f706f7365722e707567782e6f72672f6172632f626173652f6c6963656e73652e737667)](https://packagist.org/packages/arc/base)

arc\\base is part of [ARC - a component library](http://www.github.com/Ariadne-CMS/arc-arc/). 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 .

Installation
------------

[](#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
-----------------

[](#arcbase-contains)

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

Example code
------------

[](#example-code)

### \\arc\\path

[](#arcpath)

```
\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

[](#arctree)

```
$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

[](#archash)

```
\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' ]

```

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance86

Actively maintained with recent releases

Popularity30

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 82.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~389 days

Recently: every ~552 days

Total

12

Last Release

69d ago

Major Versions

1.1 → 2.02015-12-18

2.1.1 → 3.02020-02-23

PHP version history (3 changes)1.0PHP &gt;=5.4

2.1PHP &gt;=5.6

3.0PHP &gt;=7.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/110959?v=4)[Auke](/maintainers/Auke)[@Auke](https://github.com/Auke)

---

Top Contributors

[![poef](https://avatars.githubusercontent.com/u/1006453?v=4)](https://github.com/poef "poef (226 commits)")[![mjrider](https://avatars.githubusercontent.com/u/213105?v=4)](https://github.com/mjrider "mjrider (48 commits)")

---

Tags

componentscomponent

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/arc-base/health.svg)

```
[![Health](https://phpackages.com/badges/arc-base/health.svg)](https://phpackages.com/packages/arc-base)
```

###  Alternatives

[knplabs/knp-components

Knplabs component library

77443.6M46](/packages/knplabs-knp-components)[livewire/flux

The official UI component library for Livewire.

9475.0M86](/packages/livewire-flux)[league/uri-components

URI components manipulation library

31932.3M67](/packages/league-uri-components)[nette/component-model

⚛ Nette Component Model

28516.5M92](/packages/nette-component-model)[phpoffice/common

PHPOffice Common

23512.3M36](/packages/phpoffice-common)[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
