Download the PHP package m-wardany/hash-ids without Composer

On this page you can find all versions of the php package m-wardany/hash-ids. 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 hash-ids

Hash Id

A Laravel package designed to hash sequential keys into random-appearing characters, making them difficult to predict. Each hashed key is guaranteed to be unique without requiring database existence checks before saving.

Features

Installation

Step 1: Install via Composer

Step 2: Publish Configuration

This will create a config/hashid.php file where you can customize the default settings.

Configuration

Update config/hashid.php to set your global defaults:

Usage

Basic Setup

To use hash IDs in your model, implement the Hashable interface and use the HasHashId trait:

Hash Builder Methods

The HashBuilder class provides three static methods for creating hash configurations:

1. Mixed Alphabet (Alphanumeric)

Generates hashes using both letters and numbers (e.g., aB3xK9)

2. Text Only

Generates hashes using only letters (e.g., aBxKmP)

3. Integer Only

Generates hashes using only numbers (e.g., 839201)

Customization Options

Minimum Length

Sets the minimum length of the generated hash.

Prefix

Adds a static prefix to the hash (e.g., POST-aB3xK9).

Suffix (Static)

Adds a static suffix to the hash (e.g., aB3xK9-ACTIVE).

Suffix (Dynamic)

Adds a dynamic suffix based on model data.

Custom Encryption Key

Uses a custom encryption key instead of the global default.

Advanced Examples

Single Hash with Dynamic Suffix

Multiple Hashes for One Attribute

Complex Multi-Attribute Setup

How It Works

  1. Implement Interface: Add the Hashable interface to your model
  2. Use Trait: Include the HasHashId trait
  3. Define Attributes: Specify which attributes to hash in getHashAttributes()
  4. Automatic Hashing: Hashes are generated automatically when the model is saved
  5. Access Hashed Values: Access via the configured attribute name (e.g., $post->post_key)

Database Schema

Ensure your database has columns for the hashed attributes:

Best Practices

Security Considerations

License

This package is open-source software licensed under the MIT license.


All versions of hash-ids with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
katoni/php-ffx Version ^1.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 m-wardany/hash-ids contains the following files

Loading the files please wait ...