PHP code example of dadeg / php-crowdflower

1. Go to this page and download the library: Download dadeg/php-crowdflower 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/ */

    

dadeg / php-crowdflower example snippets


use CrowdFlower\Account;
$crowd = new Account($apiKey);

// get list of ten most recent jobs from account
$jobs = $crowd->getJobs();

// get list of ten jobs from account starting at page 2
$jobs = $crowd->getJobs(2);

// get job by job id
$job = $crowd->getJob($jobId);

// create empty job
$job = $crowd->createJob();

// create job with job info
$job = $crowd->createJob(array(
    "title" => "A brand new job",
    "instructions" => "Follow these rules..."
));

// jobs can also be created from a copy of an existing job
$jobCopy = $crowd->getJob($jobId)->copy();

// create units from array
$units = $job->createUnits(array (
  array ("data" => array('column1' => 'value', 'column2' => 'value')),
  array ("data" => array('column1' => 'value2', 'column2' => 'value2'))
));

// units can also be created individually
$unit = $job->createUnit(array('data' => array('column1' => 'value', 'column2' => 'value')));

// jobs can create orders
$order = $job->createOrder($numberOfUnits, $channels);

  "dadeg/php-crowdflower": "0.1.*"
bash
  composer update dadeg/php-crowdflower