PHP code example of blake / laraveldoctrine-hashids

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

    

blake / laraveldoctrine-hashids example snippets


    'custom_types'              => [
        // ...
        'hashid' => Blake\Dbal\Types\HashidType::class,
    ],



namespace App\Entities;

use Doctrine\ORM\Mapping AS ORM;

/**
 * @ORM\Entity
 * @ORM\Table
 */
class User
{
    /**
     * @var string
     * @ORM\Id
     * @ORM\Column(type="hashid", nullable=false)
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    protected $id;
    
    // ...
}

$user = EntityManager::find(User::class, 'dlGRfgH73');