Skip to content

Instantly share code, notes, and snippets.

@joetannenbaum
Created February 6, 2017 17:09
Show Gist options
  • Save joetannenbaum/15552c8cb0730ab355048e86f42ae1f8 to your computer and use it in GitHub Desktop.
Save joetannenbaum/15552c8cb0730ab355048e86f42ae1f8 to your computer and use it in GitHub Desktop.
<?php
use Hashids\Hashids;
class Hasher
{
public static function encode(...$args)
{
return app(Hashids::class)->encode(...$args);
}
public static function decode($enc)
{
if (is_int($enc)) {
return $enc;
}
return app(Hashids::class)->decode($enc)[0];
}
}
@gopalkumar315
Copy link

Awesome, can you tell me where to create hasher class?.

@MilesHart
Copy link

You put the Hasher.php in your App folder. The documentation is poor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment