PHP code example of goldfinch / harvest

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

    

goldfinch / harvest example snippets


namespace App\Mills;

use Goldfinch\Mill\Mill;

class PageMill extends Mill
{
    public function factory(): array
    {
        return [
            'Title' => $this->faker->catchPhrase(),
            'Content' => $this->faker->paragraph(20),
        ];
    }
}

namespace {

    use Goldfinch\Mill\Traits\Millable;
    use SilverStripe\CMS\Model\SiteTree;

    class Page extends SiteTree
    {
        use Millable;

        private static $db = [];
    }
}

namespace App\Harvest;

use Goldfinch\Harvest\Harvest;

class PagesHarvest extends Harvest
{
    public static function run(): void
    {
        \Page::mill(10)->make();
    }
}
bash
php taz make:harvest
bash
php taz harvest
bash
php taz harvest myharvest
bash
php taz harvest:all
bash
php taz dev/build
bash
php taz harvest
bash
php taz harvest pages