PHP Crowdflower API integration.
There are examples of every method of interacting with the CrowdFlower API in the examples folder. The tests are almost at full coverage. I use this package daily and it has been reliable. In order to run the tests yourself you will need to replace the API key in tests/fixtures with your own API key.
Add to composer.json
Update composer for existing projects
composer update dadeg/php-crowdflower
Composer install for new projects
use CrowdFlower\Account; $crowd = new Account($apiKey);
Getting existing Jobs
// 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);
Creating new Jobs
// 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);
When attributes are updated via the setAttribute() method, the changes are tracked and only those are sent to CrowdFlower when an update is made.
The Request object is passed as a dependency in order to properly run tests.