1. Go to this page and download the library: Download etouches/phplumber 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/ */
etouches / phplumber example snippets
class CreateDatabase extends Process
{
public function invoke($payload)
{
$database_name = $payload['database_name'];
echo "Drop database $database_name if it exists...\n";
echo "Creating database $database_name...\n";
}
}
class CreateTable extends MultiProcess
{
// Determine the data we need to queue for async processes
public function getAsyncPayloads($payload)
{
$database_name = $payload['database_name'];
$table_names = array('first_table', 'second_table', 'third_table');
$payloads = array();
foreach ($table_names as $table) {
$payloads[] = array('database_name' => $database_name, 'table_name' => $table);
}
return $payloads;
}
public function invoke($payload)
{
$database_name = $payload['database_name'];
$table_name = $payload['table'];
echo "Connecting to database $database_name...\n";
echo "Creating and populating $table_name...\n";
switch ($payload['table']) {
case 'first_table':
// Create table and insert rows...
break;
// ...
}
}
}
class CreateAndFillDatabase extends ProcessList
{
protected function setup()
{
$this
->add('CreateDatabase')
->add('CreateTable')
->add('CreateViews');
}
}
$equation = new CreateAndFillDatabase();
$equation->process(array('database_name' => 'test_db'));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.