Download the PHP package mcris112/laravel-hashidable without Composer

On this page you can find all versions of the php package mcris112/laravel-hashidable. 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-hashidable

Laravel Hashidable

Latest Version on Packagist License

Laravel Hashidable provides a seamless way to use Hashids in your Laravel models. It automatically handles encoding/decoding of IDs for routing and database lookups, keeping your internal IDs hidden from the public.

This package is an enhanced fork of the original kayandra/hashidable, featuring improved type safety, caching support, global helpers, and fluent query builder integration.

✨ Key Features


📥 Installation

⚙️ Setup

Add the Hashidable trait to your Eloquent model:


🚀 Usage

Basic Operations

Advanced Querying & Relations

Thanks to the new fluent scopes, you can now load relationships while finding by hashid:

Validation Rule

You can validate that a hashid exists in the database using the hashid_exists rule. This automatically decodes the hashid before checking the database.

The rule accepts two parameters:

  1. The Model class or Table name.
  2. The Database column (optional, defaults to the model's primary key or id).

Global Helpers

Decode or encode hashids anywhere without needing a model instance:


🔗 Route Model Binding

This package automatically handles Route Model Binding. Instead of IDs, your routes will use hashids:

Generating links automatically uses the hashid:


⚡ Performance Caching

If you find yourself decoding the same hashids frequently, you can enable caching in the config. This will store the decoded integer ID in your cache store.


🛠️ Configuration

Publish the configuration file:

Global Config (config/hashidable.php)

Option Description Default
salt Unique salt for hash generation env(HASHIABLE_SALT)
length Minimum length of generated hash 16
charset Characters used in the hashid a-zA-Z0-9
prefix Optional prefix for hashids ""
suffix Optional suffix for hashids ""
separator Separator between prefix/suffix "-"

Per-Model Configuration

Implement HashidableConfigInterface to customize settings for a specific model:


❓ FAQ

Q: Are hashes stored in the database?
A: No. Hashes are calculated dynamically based on your model's ID and salt.

Q: What happens if I change my salt?
A: All existing hashids will change. It's recommended to set a permanent salt in your .env file (HASHIABLE_SALT).


📄 License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-hashidable with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0
hashids/hashids Version ^4.0
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 mcris112/laravel-hashidable contains the following files

Loading the files please wait ...