Add HashIds

This commit is contained in:
Daniel Supernault 2018-04-15 21:45:19 -06:00
parent 5f775ce648
commit 8a932e8e1f
3 changed files with 255 additions and 2 deletions

View file

@ -8,7 +8,8 @@
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"laravel/framework": "5.6.*",
"laravel/tinker": "^1.0"
"laravel/tinker": "^1.0",
"vinkla/hashids": "^5.0"
},
"require-dev": {
"filp/whoops": "^2.0",

200
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d5bca48e56bbf3a25645858fcab9c285",
"content-hash": "dd601926aa197140c36a00ea3a325118",
"packages": [
{
"name": "dnoegel/php-xdg-base-dir",
@ -366,6 +366,132 @@
],
"time": "2018-02-07T20:20:57+00:00"
},
{
"name": "graham-campbell/manager",
"version": "v4.0.0",
"source": {
"type": "git",
"url": "https://github.com/GrahamCampbell/Laravel-Manager.git",
"reference": "95b654ac39eae15299c6c7400249c204c8ae7bf0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/GrahamCampbell/Laravel-Manager/zipball/95b654ac39eae15299c6c7400249c204c8ae7bf0",
"reference": "95b654ac39eae15299c6c7400249c204c8ae7bf0",
"shasum": ""
},
"require": {
"illuminate/contracts": "5.5.*|5.6.*",
"illuminate/support": "5.5.*|5.6.*",
"php": "^7.1.3"
},
"require-dev": {
"graham-campbell/analyzer": "^2.0",
"graham-campbell/testbench-core": "^3.0",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^6.5|^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
},
"autoload": {
"psr-4": {
"GrahamCampbell\\Manager\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Graham Campbell",
"email": "graham@alt-three.com"
}
],
"description": "Manager Provides Some Manager Functionality For Laravel 5",
"keywords": [
"Graham Campbell",
"GrahamCampbell",
"Laravel Manager",
"Laravel-Manager",
"connector",
"framework",
"interface",
"laravel",
"manager"
],
"time": "2018-02-11T14:57:19+00:00"
},
{
"name": "hashids/hashids",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/ivanakimov/hashids.php.git",
"reference": "b6c61142bfe36d43740a5419d11c351dddac0458"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ivanakimov/hashids.php/zipball/b6c61142bfe36d43740a5419d11c351dddac0458",
"reference": "b6c61142bfe36d43740a5419d11c351dddac0458",
"shasum": ""
},
"require": {
"php": "^7.1.3"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
},
"suggest": {
"ext-bcmath": "Required to use BC Math arbitrary precision mathematics (*).",
"ext-gmp": "Required to use GNU multiple precision mathematics (*)."
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"psr-4": {
"Hashids\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ivan Akimov",
"email": "ivan@barreleye.com",
"homepage": "https://twitter.com/IvanAkimov"
},
{
"name": "Vincent Klaiber",
"email": "hello@vinkla.com",
"homepage": "https://vinkla.com"
}
],
"description": "Generate short, unique, non-sequential ids (like YouTube and Bitly) from numbers",
"homepage": "http://hashids.org/php",
"keywords": [
"bitly",
"decode",
"encode",
"hash",
"hashid",
"hashids",
"ids",
"obfuscate",
"youtube"
],
"time": "2018-03-12T16:30:09+00:00"
},
{
"name": "jakub-onderka/php-console-color",
"version": "0.1",
@ -2173,6 +2299,78 @@
"homepage": "https://github.com/tijsverkoyen/CssToInlineStyles",
"time": "2017-11-27T11:13:29+00:00"
},
{
"name": "vinkla/hashids",
"version": "5.0.0",
"source": {
"type": "git",
"url": "https://github.com/vinkla/laravel-hashids.git",
"reference": "038e6bd44ce07225e89fee1cd52c00316bc4fec8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/vinkla/laravel-hashids/zipball/038e6bd44ce07225e89fee1cd52c00316bc4fec8",
"reference": "038e6bd44ce07225e89fee1cd52c00316bc4fec8",
"shasum": ""
},
"require": {
"graham-campbell/manager": "^4.0",
"hashids/hashids": "^3.0",
"illuminate/contracts": "5.6.*",
"illuminate/support": "5.6.*",
"php": "^7.1.3"
},
"require-dev": {
"graham-campbell/analyzer": "^2.0",
"graham-campbell/testbench": "^5.0",
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
},
"laravel": {
"providers": [
"Vinkla\\Hashids\\HashidsServiceProvider"
],
"aliases": {
"Hashids": "Vinkla\\Hashids\\Facades\\Hashids"
}
}
},
"autoload": {
"psr-4": {
"Vinkla\\Hashids\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Vincent Klaiber",
"email": "hello@vinkla.com",
"homepage": "https://vinkla.com"
}
],
"description": "A Hashids bridge for Laravel",
"keywords": [
"bitly",
"decrypt",
"encrypt",
"hash",
"hashid",
"hashids",
"ids",
"laravel",
"obfuscate",
"youtube"
],
"time": "2018-03-12T16:38:13+00:00"
},
{
"name": "vlucas/phpdotenv",
"version": "v2.4.0",

54
config/hashids.php Normal file
View file

@ -0,0 +1,54 @@
<?php
/*
* This file is part of Laravel Hashids.
*
* (c) Vincent Klaiber <hello@vinkla.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare(strict_types=1);
return [
/*
|--------------------------------------------------------------------------
| Default Connection Name
|--------------------------------------------------------------------------
|
| Here you may specify which of the connections below you wish to use as
| your default connection for all work. Of course, you may use many
| connections at once using the manager class.
|
*/
'default' => 'main',
/*
|--------------------------------------------------------------------------
| Hashids Connections
|--------------------------------------------------------------------------
|
| Here are each of the connections setup for your application. Example
| configuration has been included, but you may add as many connections as
| you would like.
|
*/
'connections' => [
'main' => [
'salt' => env("APP_HASHID_SALT", "v3MsJ1Hgnlma8YPrD3f4sW6vAn6zLnkuh6vOpKnR5IKkLqDGIk7TCADS2igpEN4ADrtXkkzV2E8HBfzpz7BreDzQqVOYDMeb4cJ1xhDhDwDeicZVUPyrxihHDaMWpTsP"),
'length' => '24',
],
'alternative' => [
'salt' => 'your-salt-string',
'length' => 'your-length-integer',
],
],
];