PHP code example of dcarbone / camel

1. Go to this page and download the library: Download dcarbone/camel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dcarbone / camel example snippets


use \DCarbone\Camel\Camel;

$camel = new Camel();

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

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

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

$queryXML = (string)$camel;

$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();

$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');