PHP code example of cimrie / slick

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

    

cimrie / slick example snippets




return [
    'managers' => [
       
        'default' => [
            // ...
            
            'meta'      => env('DOCTRINE_METADATA', \CImrie\Slick\Mapping\SlickDriver::class),
            'mappings'  => [
               MyCustomMappingClass::class 
            ]
            
            // ...
        ]
    ]
];



use \Tests\Model\Documents\User;
use CImrie\Slick\Slick;

class CustomMapping extends \CImrie\Slick\Mapping\DocumentMapping
{
    public static function mapFor(){
        return User::class;
    }
    
    public function map(Slick $builder)
    {
        $builder->id();
        $builder->string('name');
        $builder->string('email')->unique();
        // alternatively add the unique constraint manually
        //... $builder->index()->key('email')->unique();
        
        $builder->date('joinedAt');
    }
}