PHP code example of recruiterphp / recruiter
1. Go to this page and download the library: Download recruiterphp/recruiter 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/ */
recruiterphp / recruiter example snippets
use Recruiter\Recruiter;
use Recruiter\Workable;
use Recruiter\WorkableBehaviour;
use MongoDB\Client;
// Create a job class
class EmailJob implements Workable
{
use WorkableBehaviour;
public function execute(): void
{
// Write your logic here
mail(
$this->parameters['email'],
$this->parameters['subject'],
$this->parameters['body']
);
}
}
// Connect to MongoDB
$factory = new Factory();
$db = $factory->getMongoDb(
MongoURI::fromEnvironment(),
$options = [],
);
// Set up Recruiter
$recruiter = new Recruiter($db);
// Schedule a job
new EmailJob([
'email' => '[email protected]',
'subject' => 'Welcome!',
'body' => 'Thanks for joining us!'
])
->asJobOf($recruiter)
->inBackground()
->execute();