Download the PHP package delgont/armor without Composer

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

Delgont Armor

Armor is a Laravel package that provides a powerful access control system through roles and permissions, along with flexible backend authentication. This package allows login using either email, username, phone number, or another identifier, based on your preference.

Furthermore, the package enables user type-based access control through the HasUserTypes trait, offering fine-grained control over user access to specific routes and Blade views.

Features

  1. User Type-based Access Control - Enables route and Blade access based on user types.
  2. Multi-Authentication Credentials - Supports login with different fields, such as email, username, or phone number.
  3. Role and Permission Management - Assign roles and permissions to control access at a more granular level.

Email or username authentication Access control using roles and permissions.

Composer Laravel Framework 11.0+

Table Of Contents

Installation

To install the Delgont/Armor package, use Composer:

After installation, publish the package configuration:

This command will publish the config/armor.php file, where you can set up custom configurations.


Configuration

Permission Delimiter Configuration
Permission Registrars Configuration

Adding Multi-Credentials Authenticationion

To allow users to log in with different credentials, such as email or username, email or phone.

  1. Import the Trait: In your LoginController, import the MultiAuthCredentials trait :

  2. Setup the Login Field: In your LoginController, set up a method to allow dynamic field selection, if you want the user to login using phone or email then you can choose this function to retunr phone_email and this should be defined as the name for you login form input

  3. Define the username column name that will be used by Overriding the getSecondaryColumn() function in your LoginController. This function specifies the second column that will be used along with email during authentication. By default, it returns 'name', but you can modify it to use the column you intend to use.

  4. Implement Multi-Credentials: Use the multiAuthCredentials() method to check the user’s login input and determine the field (username or email, phone or email) they are attempting to log in with. Override the credentials method in LoginController :

  5. Login Form Input: Your login form should use the username_email field, which allows the user to enter their username or email or phone_email if you want to allow login with phone or email

LoginController

User Type-Based Access Control

User type-based access control allows you to restrict specific routes and Blade templates based on user roles, such as "master" or "employee."

  1. add usertype & user_id columns to your authenticatable migration

  2. Add Delgont\Auth\Concerns\HasUserTypes Trait to user model.

  3. Your usertype models

Blade Directives

@usertype Blade Directive

The @usertype Blade directive allows you to check if the currently authenticated user matches any of the specified user types. This directive can be used to conditionally render content based on the user's type, providing a flexible way to manage permissions and access control in your views.

Usage
@can Blade Directive
Usage
@rolecan Blade Directive

The @rolecan directive allows you to check if the authenticated user's role has the specified permissions before granting access to a particular section of your Blade view. This directive is particularly useful for managing access control based on user roles and their associated permissions.

Your Authenticatable models must be limited to a single role, use Delgont\Armor\Concerns\ModelHasSingleRole and migrations must have role_id

<h6 style="color: #FF6347;"">Usage

  1. Your login View.

Middlewares

1. Track Page Access

track.page-access:page-name

This middleware is responsible for tracking the times a page has been access on a Laravel application. It logs information about page views, including the IP address, User-Agent, and visit count for each page. If a user accesses the same page multiple times, the middleware will update the count and store the latest User-Agent information.

Usage

To use this middleware, it should be registered in your app/Http/Kernel.php file or applied directly to specific routes in the routes/web.php file.


Artisan Commands

Role Artisan Commands

Role Artisan Commands


All versions of armor with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2.5 || ^8.0
illuminate/support Version ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
illuminate/auth Version ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
illuminate/database Version ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0
laravel/helpers Version ^1.5.0 || 1.6.0 || 1.7.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 delgont/armor contains the following files

Loading the files please wait ....