Download the PHP package litepie/shield without Composer

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

Litepie Shield - Laravel Role and Permission System

A production-ready Laravel package for role and permission-based access control, built from scratch with all the features from Spatie's Laravel Permission package and enhanced with additional capabilities.

โœจ Features

๐Ÿ“‹ Table of Contents

๐Ÿš€ Installation

Requirements:

Publish the migration and config file:

Run the migrations:

Quick Setup

Create Super User

After installation, create a super user with full admin privileges:

This command will:

You can also run it non-interactively:

โš™๏ธ Configuration

The configuration file config/shield.php provides extensive customization options:

Configuration Options Explained

Option Description Default
models.permission Permission model class Litepie\Shield\Models\Permission
models.role Role model class Litepie\Shield\Models\Role
table_names.* Database table names Standard naming
cache.expiration_time Cache duration 24 hours
cache.store Cache store to use default
tenants Enable multi-tenant support false
use_passport_client_credentials API authentication false
enable_wildcard_permission Hierarchical permissions false
events_enabled Event firing false

๐Ÿ“š Basic Usage

Setting up Models

Add the HasRoles trait to your User model:

For models that only need permissions (not roles), use HasPermissions:

Creating Roles and Permissions

Basic Creation

Advanced Creation with Guards

Assigning Roles and Permissions

Role Assignment

Direct Permission Assignment

Checking Permissions and Roles

Permission Checks

Role Checks

Advanced Checks

๐Ÿš€ Advanced Features

Custom Models

Extend the base models to add your own functionality:

Update your config:

Multiple Guards

Shield supports multiple authentication guards seamlessly:

Permission Inheritance

Create hierarchical permission structures:

๐Ÿข Multi-Tenant Support

Shield provides complete multi-tenant isolation with tenant-based permissions.

Enable Tenants

Tenant Context Management

Tenant-Specific Operations

Custom Tenant Resolver

Implement automatic tenant detection:

Register in AppServiceProvider:

Multi-Tenant Middleware

โญ Wildcard Permissions

Register the middleware in your Kernel.php:

Advanced Middleware Usage

Custom Middleware

Create your own permission middleware:

๐ŸŽจ Blade Directives

Beautiful template-level permission checking.

Role Directives

Permission Directives

Advanced Blade Usage

๐Ÿ—ƒ๏ธ Database Queries

Powerful Eloquent scopes for complex permission queries.

User Queries

Tenants Feature

Enable tenants in config:

Set the tenant context:

Create hierarchical permissions with pattern matching:

Enable Wildcards

Wildcard Patterns

Wildcard Examples

๐Ÿšง Middleware

Protect your routes with flexible middleware options.

Register Middleware

Add to app/Http/Kernel.php:

Basic Usage

bash

Create permission

php artisan shield:create-permission "edit articles" php artisan shield:create-permission "manage users" --guard=web

Create role

php artisan shield:create-role writer php artisan shield:create-role "content manager" --guard=web

Create super user with full admin access

php artisan shield:create-superuser

Interactive mode (prompts for details)

php artisan shield:create-superuser

Non-interactive mode

php artisan shield:create-superuser --name="Site Administrator" --email="[email protected]" --password="secure-password-123"

Clear permission cache

php artisan shield:cache-reset bash

Create tenant-specific permission

php artisan shield:create-permission "manage inventory" --tenantId=1

Create tenant-specific role

php artisan shield:create-role "warehouse manager" --tenantId=1

Create superuser for specific tenant

php artisan shield:create-superuser --tenantId=1 bash

Show all roles and permissions

php artisan shield:show

Upgrade database for tenants feature

php artisan shield:upgrade-for-tenants

Custom commands you can create

php artisan make:command AssignBulkPermissions php artisan make:command SyncUserRoles php artisan make:command AuditPermissions bash

Clone the repository

git clone https://github.com/litepie/shield.git cd shield

Install dependencies

composer install

Run tests

composer test

Run code analysis

composer analyse

Run code formatting

composer format bash

Run all tests

composer test

Run specific test

./vendor/bin/phpunit tests/PermissionTest.php

Run with coverage

composer test-coverage

Role and Permission Queries

Advanced Queries

๐Ÿ“ก Events

Listen to role and permission changes throughout your application.

Enable Events

Available Events

Event Listeners

Example Listeners

Real-time Updates

๐Ÿ”Œ API Integration

Full support for API authentication and machine-to-machine communication.

Passport Integration

Enable Passport client credentials:

API Authentication

Machine-to-Machine

API Controllers

โšก Performance & Caching

Optimized for high-performance applications with intelligent caching.

Cache Configuration

Cache Management

Performance Tips

Laravel Octane Support

Shield is fully compatible with Laravel Octane:

โš™๏ธ Artisan Commands

License

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

๐Ÿ†˜ Support

๐ŸŽฏ Roadmap


Made with โค๏ธ by Litepie

Shield - Your Laravel application's guardian angel for role and permission management.


All versions of shield with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0
illuminate/contracts Version ^10.0|^11.0|^12.0
illuminate/auth Version ^10.0|^11.0|^12.0
illuminate/cache Version ^10.0|^11.0|^12.0
illuminate/console Version ^10.0|^11.0|^12.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 litepie/shield contains the following files

Loading the files please wait ....