Download the PHP package mahdisphp/laravel-realm without Composer

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

Version Downloads


What is Realm?

Realm adds multi-tenancy to your Laravel app with a single trait and a safety-first approach. It's designed for the 80% of SaaS apps that need row-level tenant isolation in a single database.

Column strategy only. Database-per-tenant and schema-per-tenant strategies are coming in v1.0.

What makes Realm different?

What Realm is NOT (yet)

Requirements

Installation

Quick Start

1. Add the trait to your model

2. Add the column to your migration

3. Wrap your routes

4. That's it

Key Concepts

The Facade vs The Model

Strict Mode (Default: ON)

When no tenant context is active:

Escape Hatches

Shared vs Tenant Models

Not every model needs tenant scoping:

Cache / Queue / Storage Isolation

Cache Key Prefixing

When a tenant is active, all cache keys are automatically prefixed with realm:{tenant_key}:. No code changes needed.

Queue Context Propagation

Add the RealmAwareJob trait to your jobs. It captures the tenant context at dispatch time and restores it when the job is processed.

Storage Path Prefixing

All storage paths are automatically prefixed with tenants/{tenant_key}/:

Encrypted Secrets

Store sensitive per-tenant configuration (API keys, tokens) encrypted at rest:

Secrets are:

Tenant User Relationships

The tenant_users pivot table links users to tenants with roles:

Per-Tenant Config Overrides

Store non-sensitive config overrides in the tenant's data JSON column:

API keys and secrets should use setSecret(), not config overrides.

Resolvers

Realm resolves the tenant from the incoming request using a pipeline of resolvers. The first match wins.

Resolver Config Example
SubdomainResolver realm.subdomain.domain acme.myapp.com
HeaderResolver realm.header.name X-Realm: acme
PathResolver realm.path.segment myapp.com/acme/dashboard
DomainResolver — app.acmecorp.com (full custom domain)
QueryResolver realm.query.parameter ?realm=acme
SessionResolver realm.session.key Session-based switching
AuthResolver — Resolves from authenticated user's tenant

Configure active resolvers in config/realm.php:

Commands

Testing

Blueprint Macro

restrictOnDelete is the default — deleting a tenant fails with a foreign key error, forcing you to handle data cleanup explicitly.

Configuration

After installation, the config lives at config/realm.php:

Why not stancl/tenancy?

Use stancl if you need database-per-tenant today — it has years of battle-testing we don't. Realm is for the 80% of SaaS apps that only need column-based row isolation and want it with one trait, one macro, and fail-closed defaults out of the box.

Roadmap

License

MIT. See LICENSE.


All versions of laravel-realm with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
illuminate/console Version ^11.0|^12.0|^13.0
illuminate/log Version ^11.0|^12.0|^13.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 mahdisphp/laravel-realm contains the following files

Loading the files please wait ...