{"id":18884248,"url":"https://github.com/dcarbone/camel","last_synced_at":"2026-02-22T10:30:18.476Z","repository":{"id":19252015,"uuid":"22487613","full_name":"dcarbone/camel","owner":"dcarbone","description":"A library designed to help facilitate SharePoint CAML query construction","archived":false,"fork":false,"pushed_at":"2018-02-02T03:30:29.000Z","size":108,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T04:22:39.720Z","etag":null,"topics":["caml","php","sharepoint","sharepoint-caml-query","xml"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"remilia15/android_device_samsung_core33g","license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcarbone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-07-31T22:36:37.000Z","updated_at":"2023-10-28T21:48:03.000Z","dependencies_parsed_at":"2022-08-01T04:18:02.179Z","dependency_job_id":null,"html_url":"https://github.com/dcarbone/camel","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcarbone%2Fcamel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcarbone%2Fcamel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcarbone%2Fcamel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcarbone%2Fcamel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcarbone","download_url":"https://codeload.github.com/dcarbone/camel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239854281,"owners_count":19708043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["caml","php","sharepoint","sharepoint-caml-query","xml"],"created_at":"2024-11-08T07:11:48.244Z","updated_at":"2026-02-22T10:30:18.431Z","avatar_url":"https://github.com/dcarbone.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"camel\n=====\n\nA library designed to help facilitate SharePoint CAML query construction\n\n**Build Status**\n- master: [![Build Status](https://travis-ci.org/dcarbone/camel.svg?branch=master)](https://travis-ci.org/dcarbone/camel)\n\n## Install\n\n```json\n\"require\" : {\n    \"dcarbone/camel\" : \"@stable\"\n},\n```\n\n## Initialization\n\nTo begin, simply create a new Camel.\n\n```php\nuse \\DCarbone\\Camel\\Camel;\n\n$camel = new Camel();\n```\n\n## Humps\n\nOnce you have created your Camel, you start adding humps!\n\nThere are 3 types of humps:\n\n- [Where](https://github.com/dcarbone/camel/tree/master/src/Hump/Where.php)\n- [OrderBy](https://github.com/dcarbone/camel/tree/master/src/Hump/OrderBy.php)\n- [GroupBy](https://github.com/dcarbone/camel/tree/master/src/Hump/GroupBy.php)\n\nYou may add them to your Camel in one of two ways:\n\n```php\n// Returns a \\DCarbone\\Camel\\Hump\\Where instance that is attached to $camel\n$camel-\u003ewhere();\n\n// Alternatively...\n$where = new \\DCarbone\\Camel\\Hump\\Where();\n$camel-\u003esetWhere($where);\n```\n\nThe same applies for all humps, and both are perfectly acceptable ways of going about it.\n\n## Nodes\n\nThere are 3 primary types of nodes:\n\n- [ComparisonOperator](https://github.com/dcarbone/camel/tree/master/src/Node/ComparisonOperator)\n- [LogicalJoin](https://github.com/dcarbone/camel/tree/master/src/Node/LogicalJoin)\n- [ValueNode](https://github.com/dcarbone/camel/tree/master/src/Node/ValueNode)\n\nHere is a quick breakdown of each:\n\n### ComparisonOperator\n\nThese will probably be the most commonly used nodes in your Camel.  I believe I have implemented every\npossible Comparison Operator supported by the SharePoint CAML query system.  If I missed one, let me know!\n\n### LogicalJoin\n\nThere are only two of these:\n\n- [AndNode](https://github.com/dcarbone/camel/tree/master/src/Node/LogicalJoin/AndNode.php)\n- [OrNode](https://github.com/dcarbone/camel/tree/master/src/Node/LogicalJoin/OrNode.php)\n\nTo keep things DRY, I have most of the logic necessary for these nodes in their base class:\n\n- [AbstractLogicalJoinNode](https://github.com/dcarbone/camel/blob/master/src/Node/LogicalJoin/AbstractLogicalJoinNode.php)\n\n### ValueNode\n\nThese nodes are typically only used inside of the aforementioned ComparisonOperator nodes, and\nallow you to compare an input value to a column / etc. in your list.\n\nEach ComparisonOperator has a distinct list of allowable ValueNodes, so check their class definition\nto see what they are.\n\n## Simple Example\n\nLets say you have a SharePoint list that looks somewhat like this:\n\n| Title | Age | Gender | Profession |\n| ----- | --- | ------ | ---------- |\n| Daniel | 28 | Male | Software Developer |\n| Elizabeth | 25 | Female | Project Manager |\n| David | 59 | Male | Oncologist |\n| Beatrice | 22 | Female | Med Student |\n| Anna | 20 | Female | Retail |\n\nAnd you want to get all the females back.  You could do something like this:\n\n```php\n$camel-\u003ewhere()\n    -\u003eeq()\n        -\u003efieldRef()-\u003eattribute('name', 'Gender')-\u003eend()\n        -\u003evalue()-\u003eattribute('type', 'Text')-\u003enodeValue('female');\n\n$queryXML = (string)$camel;\n```\n\nThe above would produce the following:\n\n```xml\n\u003cQuery xmlns=\"\"\u003e\n  \u003cWhere\u003e\n    \u003cEq\u003e\n      \u003cFieldRef Name=\"Gender\" /\u003e\n      \u003cValue Type=\"Text\"\u003efemale\u003c/Value\u003e\n    \u003c/Eq\u003e\n  \u003c/Where\u003e\n\u003c/Query\u003e\n```\n\nYou can also do logical joins.\n\n```php\n$camel-\u003ewhere()\n    -\u003eorNode()\n        -\u003eeq()\n            -\u003efieldRef()-\u003eattribute('name', 'Title')-\u003eend()\n            -\u003evalue()-\u003eattribute('type', 'Text')-\u003enodeValue('Daniel')-\u003eend()\n        -\u003eend()\n        -\u003eeq()\n            -\u003efieldRef()-\u003eattribute('name', 'Title')-\u003eend()\n            -\u003evalue()-\u003eattribute('type', 'Text')-\u003enodeValue('David')-\u003eend();\n```\n\nThe above will produce:\n\n```xml\n\u003cQuery xmlns=\"\"\u003e\n  \u003cWhere\u003e\n    \u003cOr\u003e\n      \u003cEq\u003e\n        \u003cFieldRef Name=\"Title\" /\u003e\n        \u003cValue Type=\"Text\"\u003eDaniel\u003c/Value\u003e\n      \u003c/Eq\u003e\n      \u003cEq\u003e\n        \u003cFieldRef Name=\"Title\" /\u003e\n        \u003cValue Type=\"Text\"\u003eDavid\u003c/Value\u003e\n      \u003c/Eq\u003e\n    \u003c/Or\u003e\n  \u003c/Where\u003e\n\u003c/Query\u003e\n```\n\nYou may also nest to your heart's content.\n\n```php\n$camel-\u003ewhere()\n    -\u003eorNode()\n        -\u003eeq()\n            -\u003efieldRef()-\u003eattribute('name', 'Title')-\u003eend()\n            -\u003evalue()-\u003eattribute('type', 'Text')-\u003enodeValue('Daniel')-\u003eend()\n        -\u003eend()\n        -\u003eorNode()\n            -\u003eeq()\n                -\u003efieldRef()-\u003eattribute('name', 'Title')-\u003eend()\n                -\u003evalue()-\u003eattribute('type', 'Text')-\u003enodeValue('Elizabeth')-\u003eend()\n            -\u003eend()\n            -\u003eorNode()\n                -\u003eeq()\n                    -\u003efieldRef()-\u003eattribute('name', 'Title')-\u003eend()\n                    -\u003evalue()-\u003eattribute('type', 'Text')-\u003enodeValue('Beatrice')-\u003eend()\n                -\u003eend()\n                -\u003eorNode()\n                    -\u003eeq()\n                        -\u003efieldRef()-\u003eattribute('name', 'Title')-\u003eend()\n                        -\u003evalue()-\u003eattribute('type', 'Text')-\u003enodeValue('Anna')-\u003eend()\n                    -\u003eend()\n                    -\u003eeq()\n                        -\u003efieldRef()-\u003eattribute('name', 'Title')-\u003eend()\n                        -\u003evalue()-\u003eattribute('type', 'Text')-\u003enodeValue('David');\n```\n\nWhich produces:\n\n```xml\n\u003cQuery xmlns=\"\"\u003e\n  \u003cWhere\u003e\n    \u003cOr\u003e\n      \u003cEq\u003e\n        \u003cFieldRef Name=\"Title\" /\u003e\n        \u003cValue Type=\"Text\"\u003eDaniel\u003c/Value\u003e\n      \u003c/Eq\u003e\n      \u003cOr\u003e\n        \u003cEq\u003e\n          \u003cFieldRef Name=\"Title\" /\u003e\n          \u003cValue Type=\"Text\"\u003eElizabeth\u003c/Value\u003e\n        \u003c/Eq\u003e\n        \u003cOr\u003e\n          \u003cEq\u003e\n            \u003cFieldRef Name=\"Title\" /\u003e\n            \u003cValue Type=\"Text\"\u003eBeatrice\u003c/Value\u003e\n          \u003c/Eq\u003e\n          \u003cOr\u003e\n            \u003cEq\u003e\n              \u003cFieldRef Name=\"Title\" /\u003e\n              \u003cValue Type=\"Text\"\u003eAnna\u003c/Value\u003e\n            \u003c/Eq\u003e\n            \u003cEq\u003e\n              \u003cFieldRef Name=\"Title\" /\u003e\n              \u003cValue Type=\"Text\"\u003eDavid\u003c/Value\u003e\n            \u003c/Eq\u003e\n          \u003c/Or\u003e\n        \u003c/Or\u003e\n      \u003c/Or\u003e\n    \u003c/Or\u003e\n  \u003c/Where\u003e\n\u003c/Query\u003e\n```\n\n## Conclusion and Future Development\n\nAt the moment, this library serves my needs.  If you find this library useful and would like to see\nsomething added or changed, please let me know!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcarbone%2Fcamel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcarbone%2Fcamel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcarbone%2Fcamel/lists"}