Download the PHP package bspdx/keystone without Composer

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

BSPDX Keystone

Latest Version on Packagist Total Downloads License A comprehensive, production-ready authentication package for Laravel with an API-first architecture. Keystone combines the power of Laravel Fortify, Sanctum, and Spatie Laravel Passkeys to provide a full-featured auth system with:

Frontend Flexibility

Keystone works with any frontend framework:

All controllers return JSON when requested, making Keystone truly framework-agnostic at the API level.

Table of Contents

Requirements

Installation

Step 1: Install via Composer

Step 2: Publish Configuration & Assets

Step 3: Run Migrations

This will create tables for:

Step 4: Seed Demo Data (Optional)

This creates:

Step 5: Configure Fortify

In your config/fortify.php, ensure these features are enabled:

Configuration

The package configuration is located at config/keystone.php. Key settings:

Enable/Disable Features

When multi_tenant is enabled, Keystone will add a nullable tenant_id column to users, roles, permissions, and pivot tables. Keystone uses global scopes for automatic tenant isolation (not Spatie's teams feature).

Key Features:

Example:

See Multi-Tenancy Documentation for detailed architecture, usage examples, and migration guides.

RBAC Settings

Passkey Settings

Two-Factor Settings

Usage

User Model Setup

New project? Use the built-in KeystoneUser model and skip this setup entirely. See User Model Configuration for a full comparison and setup instructions.

Add the HasKeystone trait to your existing User model:

This trait combines:

You can also query users by assigned role directly from the model:

Service Layer (NEW in v0.3.0)

Keystone v0.3.0 introduces a clean service layer architecture to interact with roles, permissions, and passkeys. All external dependencies are now abstracted behind Keystone services.

Using Services in Controllers

Benefits:

Blade Components (Optional)

Keystone provides optional pre-built Blade components for Laravel projects. If you're using React, Vue, or another frontend framework, you can skip this section and use the JSON API endpoints instead.

For Laravel Blade users:

Login Form

Register Form

Two-Factor Challenge

Passkey Registration

Passkey Login

Routes

Keystone doesn't auto-register routes. Add them manually from the published examples:

Web Routes (routes/keystone-web.php):

API Routes (routes/keystone-api.php):

Middleware

Keystone provides three middleware aliases:

Role Middleware

Permission Middleware

2FA Enforcement Middleware

Checking Permissions in Code

Traditional Approach (User Model Methods)

Service Layer Approach (Recommended for Controllers)

API Usage

Keystone is designed with an API-first architecture, making it perfect for:

Authentication

Use Sanctum for API authentication. All Keystone controllers automatically return JSON when the request has Accept: application/json header or uses wantsJson():

API Endpoints

All API routes are protected with auth:sanctum middleware. Example requests:

Get All Roles:

Assign Role to User:

Enable 2FA:

Architecture

Keystone v0.3.0+ uses an API-first, service layer architecture to isolate external dependencies and provide maximum flexibility for any frontend framework.

Service Layer

All role, permission, and passkey operations go through dedicated services:

All services are registered in Laravel's service container with interface bindings and convenient aliases:

Models

Keystone provides its own model classes that extend Spatie's models:

All type hints use these Keystone models, providing a consistent BSPDX\Keystone namespace throughout your application.

Benefits

Multi-Tenancy

Keystone provides comprehensive multi-tenant support using global scopes for automatic tenant isolation. Roles and permissions can be global (accessible across all tenants) or tenant-specific (isolated per organization).

Keystone handles the RBAC side of multi-tenancy — scoping roles, permissions, and assignments to a tenant_id. It does not provide a Tenant model, tenant creation, or user-to-tenant assignment. Your application is responsible for managing tenants and populating tenant_id on your User model. Keystone reads that value automatically to scope all role and permission queries.

Quick Start

Enable multi-tenancy in your .env:

Features

Usage Examples

Creating Global Roles

Creating Tenant-Specific Roles

Super-Admin Operations

Keystone Management Commands

Keystone provides artisan commands for managing roles, permissions, and users:

Learn More

For comprehensive documentation on multi-tenancy:

HTTPS Setup

Passkeys require HTTPS! See our detailed guide: HTTPS Setup for Laravel Sail

Quick summary:

  1. Install mkcert:

  2. Generate certificates:

  3. Update .env:

  4. Configure Nginx/Caddy to use the certificates

See the full guide for detailed instructions.

Testing

Run the package tests:

Or with PHPUnit directly:

Customization

Custom Blade Views

Publish the views and modify as needed:

Views will be in resources/views/vendor/keystone/.

Custom Styling

All Blade components use CSS custom properties for easy theming:

Security

If you discover any security issues, please email [email protected] instead of using the issue tracker.

Credits

Note: Starting with v0.3.0, all Spatie dependencies are abstracted through Keystone's service layer, providing a clean BSPDX\Keystone namespace throughout your application. Starting with v0.8.0, role and permission management uses a custom built-in RBAC system; Spatie Laravel Passkeys remains as the passkey backend.

License

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


Quick Start Example

Here's a complete example to get you started quickly:

1. Install Package

2. Update User Model

3. Create Login Page

4. Add Routes

5. Test It Out

That's it! You now have a complete authentication system with 2FA, passkeys, and RBAC.

Support


All versions of keystone with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2.0
laravel/fortify Version ^1.31
laravel/framework Version ^12.0|^13.0
laravel/sanctum Version ^4.0
pragmarx/google2fa-laravel Version ^3.0
spatie/laravel-passkeys Version ^1.5
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 bspdx/keystone contains the following files

Loading the files please wait ...