PHPackages                             phpcr/phpcr-utils - 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. [CLI &amp; Console](/categories/cli)
4. /
5. phpcr/phpcr-utils

ActiveLibrary[CLI &amp; Console](/categories/cli)

phpcr/phpcr-utils
=================

PHP Content Repository implementation independant utilities

2.0.3(5mo ago)743.2M↓11.5%31[14 issues](https://github.com/phpcr/phpcr-utils/issues)11MITPHPPHP ^8.0CI passing

Since Feb 10Pushed 5mo ago4 watchersCompare

[ Source](https://github.com/phpcr/phpcr-utils)[ Packagist](https://packagist.org/packages/phpcr/phpcr-utils)[ Docs](http://phpcr.github.io)[ RSS](/packages/phpcr-phpcr-utils/feed)WikiDiscussions 2.x Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (61)Used By (11)

PHPCR Utilities
===============

[](#phpcr-utilities)

[![Build Status](https://github.com/phpcr/phpcr-utils/actions/workflows/test-application.yaml/badge.svg)](https://github.com/phpcr/phpcr-utils/actions)[![Latest Stable Version](https://camo.githubusercontent.com/a8c984955b03436f33ccb8e8e22a15f29694aacd8efcc00f32d0862a9ffde989/68747470733a2f2f706f7365722e707567782e6f72672f70687063722f70687063722d7574696c732f76657273696f6e2e706e67)](https://packagist.org/packages/phpcr/phpcr-utils)[![Total Downloads](https://camo.githubusercontent.com/257d0857355f678244440a7f6ca1cca72ee75c5da5978442014b41e1f8fb79c9/68747470733a2f2f706f7365722e707567782e6f72672f70687063722f70687063722d7574696c732f642f746f74616c2e706e67)](https://packagist.org/packages/phpcr/phpcr-utils)

Commands and implementations for common tasks for the PHP Content Repository (PHPCR) API.

If you are using or implementing [PHPCR](https://github.com/phpcr/phpcr) you probably want some of the things in here.

PHPCR Users: Note that your PHPCR implementation probably already bundles the utils.

License
-------

[](#license)

This code is dual licensed under the MIT license and the Apache License Version 2.0. Please see the file LICENSE in this folder.

Documentation
=============

[](#documentation)

The utils bring you a couple of *Commands* you can use to interact with a PHPCR repository on the command line. Additionally we provide a couple of helper classes for common tasks.

Commands
--------

[](#commands)

There are a couple of useful commands to interact with a PHPCR repository.

To use the console, make sure you have initialized the git submodules of phpcr-utils, then copy cli-config.php.dist to cli-config.php and adjust it to your implementation of PHPCR. Then you can run the commands from the phpcr-utils directory with `./bin/phpcr`NOTE: If you are using PHPCR inside of Symfony, the DoctrinePHPCRBundle provides the commands inside the normal Symfony console and you don't need to prepare anything special.

To get a list of the available commands, run `bin/phpcr` or set the commands up in your application. Running `bin/phpcr help ` outputs the documentation of that command.

Helper Classes
--------------

[](#helper-classes)

The helper classes provide implementations for basic common tasks to help users and implementers of PHPCR. They are all in the namespace PHPCR\\Util

### PathHelper

[](#pathhelper)

Used to manipulate paths. Implementations are recommended to use this, and applications also profit from it. Using `dirname` and similar file system operations on paths is not compatible with Microsoft Windows systems, thus you should always use the methods in PathHelper.

### NodeHelper

[](#nodehelper)

This helper has some generally useful methods like one to generate empty `nt:unstructured` nodes to make sure a parent path exists. It also provides some useful helper methods for implementations.

### UUIDHelper

[](#uuidhelper)

This little helper is mainly of interest for PHPCR implementers. It generates valid *Universally Unique IDs* and can determine whether a given string is a valid UUID. We recommend all implementations to use this implementation to guarantee consistent behaviour.

**Note**

You can use [ramsey/uuid](https://github.com/ramsey/uuid) library to generate UUIDs. In this case, install it using Composer and generating UUIDs will be taken over by `ramsey/uuid`.

### QOM QueryBuilder

[](#qom-querybuilder)

The `QueryBuilder` is a fluent query builder with method names matching the [Doctrine QueryBuilder](http://www.doctrine-project.org/docs/orm/2.1/en/reference/query-builder.html)on top of the QOM factory. It is the easiest way to programmatically build a PHPCR query.

### Query Object Model Converter

[](#query-object-model-converter)

In the PHPCR\\Util\\QOM namespace we provide, implementation-independant code to convert between SQL2 and QOM. `Sql2ToQomQueryConverter` parses SQL2 queries into QOM . `QomToSql2QueryConverter` generates SQL2 out of a QOM.

### TraversingItemVisitor

[](#traversingitemvisitor)

This `ItemVisitorInterface` implementation is a basic implementation of crawling a PHPCR tree. You can extend it to define what it should do while crawling the tree.

###  Health Score

64

—

FairBetter than 99% of packages

Maintenance67

Regular maintenance activity

Popularity57

Moderate usage in the ecosystem

Community38

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 53% 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 ~84 days

Recently: every ~182 days

Total

61

Last Release

170d ago

Major Versions

1.x-dev → 2.0.02023-12-02

PHP version history (9 changes)1.0-beta1PHP &gt;=5.3.0

1.1.x-devPHP &gt;=5.3.3

1.2.10PHP ^5.3.3|7.0.x|7.1.x

1.3.0PHP ^5.6|7.0.x|7.1.x

1.3.1PHP ^5.6|^7.0

1.4.1PHP ^5.6 || ^7.0

1.5.0PHP ^7.1 || ^8.0

1.7.0PHP ^7.2 || ^8.0

2.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/76576?v=4)[David Buchmann](/maintainers/dbu)[@dbu](https://github.com/dbu)

![](https://avatars.githubusercontent.com/u/20873?v=4)[Luke Smith](/maintainers/lsmith)[@lsmith](https://github.com/lsmith)

---

Top Contributors

[![dbu](https://avatars.githubusercontent.com/u/76576?v=4)](https://github.com/dbu "dbu (292 commits)")[![lsmith77](https://avatars.githubusercontent.com/u/300279?v=4)](https://github.com/lsmith77 "lsmith77 (102 commits)")[![dantleech](https://avatars.githubusercontent.com/u/530801?v=4)](https://github.com/dantleech "dantleech (54 commits)")[![chregu](https://avatars.githubusercontent.com/u/47106?v=4)](https://github.com/chregu "chregu (30 commits)")[![alexander-schranz](https://avatars.githubusercontent.com/u/1698337?v=4)](https://github.com/alexander-schranz "alexander-schranz (9 commits)")[![mamazu](https://avatars.githubusercontent.com/u/14860264?v=4)](https://github.com/mamazu "mamazu (7 commits)")[![wachterjohannes](https://avatars.githubusercontent.com/u/1464615?v=4)](https://github.com/wachterjohannes "wachterjohannes (6 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (5 commits)")[![pavelvondrasek](https://avatars.githubusercontent.com/u/7081340?v=4)](https://github.com/pavelvondrasek "pavelvondrasek (5 commits)")[![fabian](https://avatars.githubusercontent.com/u/13346?v=4)](https://github.com/fabian "fabian (4 commits)")[![webda2l](https://avatars.githubusercontent.com/u/517753?v=4)](https://github.com/webda2l "webda2l (4 commits)")[![ElectricMaxxx](https://avatars.githubusercontent.com/u/2905834?v=4)](https://github.com/ElectricMaxxx "ElectricMaxxx (3 commits)")[![uwej711](https://avatars.githubusercontent.com/u/648874?v=4)](https://github.com/uwej711 "uwej711 (3 commits)")[![piotras](https://avatars.githubusercontent.com/u/232506?v=4)](https://github.com/piotras "piotras (3 commits)")[![wouterj](https://avatars.githubusercontent.com/u/749025?v=4)](https://github.com/wouterj "wouterj (2 commits)")[![danrot](https://avatars.githubusercontent.com/u/405874?v=4)](https://github.com/danrot "danrot (2 commits)")[![hacfi](https://avatars.githubusercontent.com/u/428841?v=4)](https://github.com/hacfi "hacfi (2 commits)")[![jordisala1991](https://avatars.githubusercontent.com/u/1137485?v=4)](https://github.com/jordisala1991 "jordisala1991 (2 commits)")[![lex009](https://avatars.githubusercontent.com/u/1351919?v=4)](https://github.com/lex009 "lex009 (2 commits)")[![pitpit](https://avatars.githubusercontent.com/u/283481?v=4)](https://github.com/pitpit "pitpit (2 commits)")

---

Tags

cliphpcrcontentrepository

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpcr-phpcr-utils/health.svg)

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

###  Alternatives

[nunomaduro/collision

Cli error handling for console/command-line PHP applications.

4.6k331.8M8.5k](/packages/nunomaduro-collision)[nunomaduro/termwind

It's like Tailwind CSS, but for the console.

2.5k239.8M286](/packages/nunomaduro-termwind)[helhum/typo3-console

A reliable and powerful command line interface for TYPO3 CMS

2939.0M192](/packages/helhum-typo3-console)[buggregator/trap

A simple and powerful tool for debugging PHP applications.

2591.7M40](/packages/buggregator-trap)[laminas/laminas-cli

Command-line interface for Laminas projects

563.7M54](/packages/laminas-laminas-cli)[phpcr/phpcr-shell

Shell for PHPCR

721.3M8](/packages/phpcr-phpcr-shell)

PHPackages © 2026

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