Download the PHP package veelasky/laravel-hashid without Composer

On this page you can find all versions of the php package veelasky/laravel-hashid. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-hashid

Laravel HashId

Test Codacy Badge codecov StyleCI

Automatic HashId generator for your eloquent model.

Version Compatibilities

Laravel HashId PHP Version Laravel 5.* Laravel 6.* Laravel 7.* Laravel 8.* Laravel 9.* Laravel 10.*
1.x >=7.0 :white_check_mark: :white_check_mark: :x: :x: :x: :x:
2.x >=7.2 - <= 8.0 :x: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x:
3.0 >=7.4 || >= 8.0 :x: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :x:
3.1 >= 8.0 :x: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark: :white_check_mark:
4.x >= 8.1 :x: :x: :x: :x: :x: :white_check_mark:

Install

With laravel package auto discovery, this will automatically add this package to your laravel application.

TLDR

Simply add HashableId trait on any of your eloquent model you are intending to use with HashId.

Example:

Usage

With Eloquent Model

By default, all hash calculation will be calculated at runtime, but sometime you want to persist the hashed id to the database.

NOTE: when using persisting model, all database query will be check againts the table itself, except: $model->hash will always be calculated at runtime.

Salt

The salt is generated automatically based on your app key and hash_alphabet. If you need to use the same salt between different projects, you can set the HASHID_SALT environment variable.

Route binding

When HashableId trait is used, base getRouteKey() and resolveRouteBinding() are overwritten to use the HashId as route key.

In-Depth Coverage

This package use repository pattern to store all instantiated implementation of HashId\HashId class, this to achieve different hash result on every eloquent models defined with HashableId trait.

However you can opt-out to not using any eloquent model or implementing your own logic to the repository.

If you're using single table inheritance model, where you want to has the same calculated hash across all inherited models, use $hashKey property, this will result the calculation remain the same across all inherited model.

You can also specify the length and characters of the hashed Id with HASHID_LENGTH and HASHID_ALPHABET environment variable respectively, or you can publish the configuration file using this command:

Extra: Validation Rules

You can also use this as validation rules, simply add this rule to your validator.

License

MIT License


All versions of laravel-hashid with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
hashids/hashids Version ^4.0|^5.0
illuminate/contracts Version >=6.18
illuminate/config Version >=6.18
illuminate/support Version >=6.18
illuminate/validation Version >=6.18
illuminate/database Version >=6.18
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package veelasky/laravel-hashid contains the following files

Loading the files please wait ....