PHPackages                             dcarbone/camel - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. dcarbone/camel

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

dcarbone/camel
==============

A library designed to help facilitate SharePoint CAML query construction

0.6.0(8y ago)081MPL-2.0PHPPHP &gt;=5.3.3

Since Sep 2Pushed 8y ago1 watchersCompare

[ Source](https://github.com/dcarbone/camel)[ Packagist](https://packagist.org/packages/dcarbone/camel)[ Docs](https://github.com/dcarbone/camel)[ RSS](/packages/dcarbone-camel/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (7)Used By (0)

camel
=====

[](#camel)

A library designed to help facilitate SharePoint CAML query construction

**Build Status**

- master: [![Build Status](https://camo.githubusercontent.com/f5a3e69a457b9ebbb58e533504deffd7bccbc6fb60a60a87497ea1bf6c0616ff/68747470733a2f2f7472617669732d63692e6f72672f64636172626f6e652f63616d656c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/dcarbone/camel)

Install
-------

[](#install)

```
"require" : {
    "dcarbone/camel" : "@stable"
},
```

Initialization
--------------

[](#initialization)

To begin, simply create a new Camel.

```
use \DCarbone\Camel\Camel;

$camel = new Camel();
```

Humps
-----

[](#humps)

Once you have created your Camel, you start adding humps!

There are 3 types of humps:

- [Where](https://github.com/dcarbone/camel/tree/master/src/Hump/Where.php)
- [OrderBy](https://github.com/dcarbone/camel/tree/master/src/Hump/OrderBy.php)
- [GroupBy](https://github.com/dcarbone/camel/tree/master/src/Hump/GroupBy.php)

You may add them to your Camel in one of two ways:

```
// Returns a \DCarbone\Camel\Hump\Where instance that is attached to $camel
$camel->where();

// Alternatively...
$where = new \DCarbone\Camel\Hump\Where();
$camel->setWhere($where);
```

The same applies for all humps, and both are perfectly acceptable ways of going about it.

Nodes
-----

[](#nodes)

There are 3 primary types of nodes:

- [ComparisonOperator](https://github.com/dcarbone/camel/tree/master/src/Node/ComparisonOperator)
- [LogicalJoin](https://github.com/dcarbone/camel/tree/master/src/Node/LogicalJoin)
- [ValueNode](https://github.com/dcarbone/camel/tree/master/src/Node/ValueNode)

Here is a quick breakdown of each:

### ComparisonOperator

[](#comparisonoperator)

These will probably be the most commonly used nodes in your Camel. I believe I have implemented every possible Comparison Operator supported by the SharePoint CAML query system. If I missed one, let me know!

### LogicalJoin

[](#logicaljoin)

There are only two of these:

- [AndNode](https://github.com/dcarbone/camel/tree/master/src/Node/LogicalJoin/AndNode.php)
- [OrNode](https://github.com/dcarbone/camel/tree/master/src/Node/LogicalJoin/OrNode.php)

To keep things DRY, I have most of the logic necessary for these nodes in their base class:

- [AbstractLogicalJoinNode](https://github.com/dcarbone/camel/blob/master/src/Node/LogicalJoin/AbstractLogicalJoinNode.php)

### ValueNode

[](#valuenode)

These nodes are typically only used inside of the aforementioned ComparisonOperator nodes, and allow you to compare an input value to a column / etc. in your list.

Each ComparisonOperator has a distinct list of allowable ValueNodes, so check their class definition to see what they are.

Simple Example
--------------

[](#simple-example)

Lets say you have a SharePoint list that looks somewhat like this:

TitleAgeGenderProfessionDaniel28MaleSoftware DeveloperElizabeth25FemaleProject ManagerDavid59MaleOncologistBeatrice22FemaleMed StudentAnna20FemaleRetailAnd you want to get all the females back. You could do something like this:

```
$camel->where()
    ->eq()
        ->fieldRef()->attribute('name', 'Gender')->end()
        ->value()->attribute('type', 'Text')->nodeValue('female');

$queryXML = (string)$camel;
```

The above would produce the following:

```

      female

```

You can also do logical joins.

```
$camel->where()
    ->orNode()
        ->eq()
            ->fieldRef()->attribute('name', 'Title')->end()
            ->value()->attribute('type', 'Text')->nodeValue('Daniel')->end()
        ->end()
        ->eq()
            ->fieldRef()->attribute('name', 'Title')->end()
            ->value()->attribute('type', 'Text')->nodeValue('David')->end();
```

The above will produce:

```

        Daniel

        David

```

You may also nest to your heart's content.

```
$camel->where()
    ->orNode()
        ->eq()
            ->fieldRef()->attribute('name', 'Title')->end()
            ->value()->attribute('type', 'Text')->nodeValue('Daniel')->end()
        ->end()
        ->orNode()
            ->eq()
                ->fieldRef()->attribute('name', 'Title')->end()
                ->value()->attribute('type', 'Text')->nodeValue('Elizabeth')->end()
            ->end()
            ->orNode()
                ->eq()
                    ->fieldRef()->attribute('name', 'Title')->end()
                    ->value()->attribute('type', 'Text')->nodeValue('Beatrice')->end()
                ->end()
                ->orNode()
                    ->eq()
                        ->fieldRef()->attribute('name', 'Title')->end()
                        ->value()->attribute('type', 'Text')->nodeValue('Anna')->end()
                    ->end()
                    ->eq()
                        ->fieldRef()->attribute('name', 'Title')->end()
                        ->value()->attribute('type', 'Text')->nodeValue('David');
```

Which produces:

```

        Daniel

          Elizabeth

            Beatrice

              Anna

              David

```

Conclusion and Future Development
---------------------------------

[](#conclusion-and-future-development)

At the moment, this library serves my needs. If you find this library useful and would like to see something added or changed, please let me know!

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~249 days

Recently: every ~308 days

Total

6

Last Release

3027d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/385c0c0eae1b51f1e81ee464ff6bfb3cce32589ac252ca68cc3a8aec2e3ada14?d=identicon)[dcarbone](/maintainers/dcarbone)

---

Top Contributors

[![dcarbone](https://avatars.githubusercontent.com/u/1392439?v=4)](https://github.com/dcarbone "dcarbone (67 commits)")

---

Tags

camlphpsharepointsharepoint-caml-queryxmlphpsharepointCAML

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dcarbone-camel/health.svg)

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

###  Alternatives

[nikic/phlexy

Lexing experiments in PHP

162570.9k13](/packages/nikic-phlexy)[corveda/php-sandbox

A PHP library that can be used to run PHP code in a sandboxed environment

23483.5k2](/packages/corveda-php-sandbox)[blancks/fast-jsonpatch-php

Class designed to efficiently handle JSON Patch operations in accordance with the RFC 6902 specification

396.4k](/packages/blancks-fast-jsonpatch-php)[bupy7/xml-constructor

The array-like constructor of XML document structure.

1337.9k](/packages/bupy7-xml-constructor)

PHPackages © 2026

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