PHP code example of stratdes / php-mongo-migrations
1. Go to this page and download the library: Download stratdes/php-mongo-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/ */
stratdes / php-mongo-migrations example snippets
declare(strict_types=1);
namespace MyMigrations;
use Gruberro\MongoDbMigrations;
use MongoDB\Database;
class CreateUserCollection implements MongoDbMigrations\MigrationInterface
{
/**
* {@inheritdoc}
*/
public function getId(): string
{
return 'create-user-collection-and-its-indexes';
}
/**
* {@inheritdoc}
*/
public function getCreateDate(): \DateTime
{
return new \DateTime('2016-02-25 16:30:00');
}
/**
* Creates a user collection and it's indexes
*
* This migration creates the
composer