PHP code example of roukmoute / hashids-bundle

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

    

roukmoute / hashids-bundle example snippets




return [
    …,
    Roukmoute\HashidsBundle\RoukmouteHashidsBundle::class => ['all' => true],
];


use Hashids\HashidsInterface;

public function postShow(HashidsInterface $hashids): Response
{
    $hashids->…
}

/**
 * @Route("/users/{hashid}")
 */
public function getAction(int $user)
{
}

/**
 * @Route("/users/{id}")
 */
public function getAction(int $user)
{
}

/**
 * @Route("/users/{_hash_user}/status/{_hash_status}")
 */
public function getAction(int $user, int $status)
{
}

/**
 *                          _hash_user _hash_status
 *                                 ↕            ↕
 * public function getAction(int $user, int $status)
 */

/**
 * @Route("/users/{user}/status/{status}")
 */
public function getAction(int $user, int $status)
{
}

/**
 * @Route("/users/{hashid}")
 */
public function getAction(User $user)
{
}