PHPackages                             ajaydev/pin-generator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. ajaydev/pin-generator

ActiveLibrary

ajaydev/pin-generator
=====================

010PHP

Since Apr 11Pushed 3y ago1 watchersCompare

[ Source](https://github.com/Ajaydev4342/pin-generator)[ Packagist](https://packagist.org/packages/ajaydev/pin-generator)[ RSS](/packages/ajaydev-pin-generator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Pin-Generator
=============

[](#pin-generator)

This composer package is for Laravel to create a unique identifier, In this instance, a PIN (personal identification number), suitable for use with door locks, etc. Each time the code executes, it return at least one PIN, that has adhered to the following:

```
• The initial intention is that each PIN comprises of four numeric digits (e.g. “2845”),
• This package will not generate “obvious” numbers. This can be handled

```

programmatically to account for the following restrictions, but allow for additional to be added later

```
-> Palindromes
    • Invalid examples include : 2332,5555 etc.

-> Sequential numbers
    • Invalid examples Include : 0123,1234,1235etc.

-> Repeating numbers
    • Invalid examples Include : 1115,7377 etc.

-> As an example, 4942 would be a PIN that passes these 3 restrictions.
    • This package will provide the PINs in an apparently random order.
    • This package will not repeat a PIN until all the preceding valid PINs have been utilised - even if the solution is stopped and started between PINs being returned.
    • You can specify the lenght of the pin e.g. 4, 6, 7, 12-digit pins. But the recommendation will be to not use a very big number.

```

Table of Contents
-----------------

[](#table-of-contents)

- [Support](#Support)
- [Installation](#installation)
- [Usage](#Usage)
- [Unit Test cases](#UnitTestCases)

Support
-------

[](#support)

Supported PHP versions are from ^7.2.5 till ^8.2
Supported Laravel versions are from 8+

Installation
------------

[](#installation)

Run the following command at the root directory of your project to install the the pin-generator package:

```
composer require ajaydev/pin-generator dev-main
```

And after succesfully downloading this package add service provider to your

&lt;project\_root&gt;/config/app.php

in this array of providers

```
'providers' => [
    // add this line in your providers array
    AjayDev\PinGenerator\PinGeneratorServiceProvider::class,
],
```

this line

```
AjayDev\PinGenerator\PinGeneratorServiceProvider::class,
```

Usage
-----

[](#usage)

After completion the above mentioned steps you just need to use this facade in your controller

```
use AjayDev\PinGenerator\PinGeneratorFacade;
```

and after this simply

```
$pin = PinGeneratorFacade::generatePin(2);  #at the place of two you can pass your length as per your requirement by default it will be 4 if you remove 2
```

UnitTestCases ( Optional )
--------------------------

[](#unittestcases--optional-)

If you want you can run and see all the test cases working perfectly or not with this command in you root project directory.

```
php artisan test vendor/ajaydev/pin-generator/tests/PinGeneratorTest.php
```

That's it you are are good to go.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity24

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ae393dd9e322e9f42f9a0b695cb3206c06f78dee972c8f0206eb7fab023df9e?d=identicon)[Ajaydev4342](/maintainers/Ajaydev4342)

---

Top Contributors

[![Ajaydev4342](https://avatars.githubusercontent.com/u/26299819?v=4)](https://github.com/Ajaydev4342 "Ajaydev4342 (26 commits)")

### Embed Badge

![Health badge](/badges/ajaydev-pin-generator/health.svg)

```
[![Health](https://phpackages.com/badges/ajaydev-pin-generator/health.svg)](https://phpackages.com/packages/ajaydev-pin-generator)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
