Download the PHP package sashalenz/passcode-lock without Composer

On this page you can find all versions of the php package sashalenz/passcode-lock. 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 passcode-lock

Passcode Lock

Laravel package for passcode (4-digit PIN) lock screen with morph relationship to any model, auto-lock on inactivity, and manual lock via keyboard shortcut.

Requirements

Designed for projects with Livewire + Wireforms + Alpine.js + Tailwind.

Installation

Publish config (optional, to override defaults):

Implementation

1. Migrations

The package registers create_passcodes_table migration. The passcodes table is created when you run:

Table structure:

2. Model with passcode

Add the HasPasscodeLock trait to the model that should have a passcode (e.g. User or Admin):

Trait methods:

Method Description
passcode() MorphOne to Passcode
hasPasscodeEnabled(): bool Whether passcode is set
getPasscodeTimeoutMinutes(): int Inactivity timeout (minutes)
verifyPasscode(string $plainCode): bool Verify entered code
setPasscode(?string $plainCode, int $timeoutMinutes = 10): void Set or clear passcode
updatePasscodeTimeout(int $timeoutMinutes): void Change timeout only

Passcode is 4 digits; hashed via Laravel Hash.

3. Configuration

File config/passcode-lock.php (or published):

Environment variables (optional):

Multiple guards

To use passcode lock for both admin and web user (or other guards):

  1. Set guards in config (or PASSCODE_LOCK_GUARDS=admin,web).
  2. Models for each guard (e.g. Admin, User) must use the HasPasscodeLock trait.
  3. Set redirect_after_unlock and, if needed, login_route as arrays per guard.
  4. Middleware detects the current guard; on lock it stores locked_guard, on unlock it uses that guard.

4. Middleware

Add middleware to the web group (e.g. in bootstrap/app.php):

Or via alias:

Middleware:

5. Routes

Register package routes (e.g. in routes/web.php):

6. Lock screen view (Tailwind + Vite)

The package provides view passcode-lock::lock with Tailwind CSS and Vite layout. No color hardcoding — uses Tailwind utilities (primary-*, gray-*), overridable via @theme.

Tailwind content — add package views in resources/css/app.css:

Config options:

Key Description
view View name (default passcode-lock::lock).
layout Layout for lock view (default passcode-lock::layouts.lock). Must load Vite and Tailwind.
vite_entry Vite entry points (default ['resources/css/app.css', 'resources/js/app.js']).
page_title, app_name Page title and app name.
logo_url, logo_alt Logo.
custom_css_url URL for additional CSS.

Theme — prefers-color-scheme and localStorage.theme.

7. Profile passcode settings (Livewire + Wireforms)

The package provides a Livewire component with Wireforms fields (checkbox, text, button). Add it in your profile card:

Layout must include <x-wireforms::notification/> for success/error messages.

8. Idle and hotkey (Alpine.js)

In the layout where auto-lock and Ctrl+Alt+L manual lock are needed:

The partial registers Alpine component passcodeIdle and renders it only for users with passcode enabled. Config idle_check_interval_ms (env: PASSCODE_LOCK_IDLE_CHECK_MS) — check interval in ms (default 30000).

9. Custom passcode form (without package component)

If not using the package component, call trait methods in your own form:

Translations

The package provides translations in resources/lang/{en,uk}/auth.php and passcode.php (namespace passcode-lock::auth, passcode-lock::passcode). Keys: locked, application_locked, enter_passcode, code, logout, unlock, invalid_passcode, and passcode form labels.

Publish (optional):

Migrating from columns to passcodes table

If passcode was stored in model columns (passcode_enabled, passcode_code, passcode_timeout_minutes), migrate data to the passcodes table and drop those columns. Example migration — in the app repository using this package (e.g. migrate_passcodes_to_package_and_drop_columns).

License

MIT.


All versions of passcode-lock with dependencies

PHP Build Version
Package Version
Requires php Version ^8.5
illuminate/contracts Version ^12.0|^13.0
illuminate/database Version ^12.0|^13.0
illuminate/http Version ^12.0|^13.0
livewire/livewire Version ^4.2
spatie/laravel-package-tools Version ^1.92
xitedev/wireforms Version ^3.3.3
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 sashalenz/passcode-lock contains the following files

Loading the files please wait ...