PHP code example of dynamophp / hash-bundle

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

    

dynamophp / hash-bundle example snippets


DemoController.php

#[Route('/demo/', name: 'demo_')]
class DemoController extends AbstractController
{
    #[Route(name: 'index')]
    public function demoIndex(DynamoHasherInterface $dynamoHasher): Response
    {
        dump($dynamoHasher->hash('ob')); // 48
        dump($dynamoHasher->hash('oc')); // 32
        dump($dynamoHasher->hash('od')); // 23
        dump($dynamoHasher->hash('a')); // 38
        dump($dynamoHasher->hash('b')); // 22
        
        return new JsonResponse('ok');
    }
}

DemoService.php

class DemoService extends AbstractController
{
    public __construct(private readonly DynamoHasherInterface $dynamoHasher){}
    
    public function doSmth(string $value): void
    {
        dd($dynamoHasher->hash($value)); 
    }
}