Giter Site home page Giter Site logo

pashamesh / laravel-hashids Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nblackburn/laravel-hashids

0.0 2.0 0.0 19 KB

A hashids wrapper for Laravel and Lumen.

Home Page: https://github.com/nblackburn/laravel-hashids

License: MIT License

PHP 100.00%

laravel-hashids's Introduction

Hashids

A hashids wrapper for Laravel & Lumen.

Installation

Laravel

Inside config/app.php add the following line in your providers

LaravelHashids\Providers\LaravelServiceProvider::class

and then simply run the following artisan command...

php artisan config:publish nblackburn/laravel-hashids

Facade

To add facade support for Laravel, add the following line inside your config/app.php under the alias section...

'Parsedown' => LaravelParsedown\Facades\Parsedown::class,

Lumen

Inside bootstrap/app.php, add the following line:

$app->register(LaravelHashids\Providers\LumenServiceProvider::class);

then add the following to your .env file:

# HASHIDS

HASHIDS_SALT = YOURSECRETKEY
HASHIDS_LENGTH = 8
HASHIDS_ALPHABET = abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPAQRSTUVWXYZ1234567890

Facade

To add facade support, firstly uncomment the following line within bootstrap/app.php:

// $app->withFacades();

then register the facade like so...

$app->register(LaravelHashids\Facades\Hashids::class);

Settings

name description default
salt The secret used for hashing. MYREALLYSECRETSALT
length The maximum length of the hash. 10
alphabet The characters used for hashing. abcedefghijklmnopqrstuvwxyzABCEDEFGHIJKLMNOPQRSTUVWXYZ123456890

Usage

Encode

Encode a series of integers

app('hashids')->encode(...$integers);

or with the facade

Hashids::encode(...$integers);

Decode

Decode a encoded string back to the original integers

app('hashids')->decode($encoded);

or with the facade

Hashids::decode($encoded);

Donations

If you find this wrapper to be useful, please consider donating.

License

This library is licensed under MIT, see license.md for details.

laravel-hashids's People

Contributors

nblackburn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.