PHP code example of discorgento / module-migrations

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

    

discorgento / module-migrations example snippets


 declare(strict_types=1);
/** Copyright © Your Company. All rights reserved. */

namespace YourCompany\YourModule\Setup\Patch\Data;

use Discorgento\Migrations\Setup\Migration;

class CmsPageMyNewPage extends Migration
{
    private Migration\Facade\CmsPage $cmsPage;

    public function __construct(
        Migration\Context $context,
        Migration\Facade\CmsPage $cmsPage
    ) {
        parent::__construct($context);
        $this->cmsPage = $cmsPage;
    }

    protected function execute()
    {
        $this->cmsPage->create('my-new-page', [
            'title' => 'Lorem Ipsum',
            'content' => <<<HTML
                <span>Hello World!</span>
            HTML,
        ]);
    }
}