Download the PHP package fzengin19/laravel-approval without Composer

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

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads Code Coverage Status

A comprehensive approval system package for PHP 8.3+ and Laravel 10+. It provides a flexible way to manage approval statuses for your models. Developed with a TDD approach, with reliable code and high test coverage.

✨ Features

πŸš€ Quick Start

1. Installation

2. Publish and Migrate

3. Add Trait to Your Model

4. Start Using

That's it. Your model now has full approval functionality.

πŸ“¦ Installation

Requirements

Install via Composer

Publish Configuration

Run Migrations

βš™οΈ Configuration

The published config file (config/approvals.php) contains comprehensive configuration options. Here are the key sections:

allow_custom_reasons is kept for backward compatibility in the config shape, but unknown reasons are still normalized to other.

Note: Approval statuses are managed by the LaravelApproval\Enums\ApprovalStatus enum:

πŸ“– Usage Guide

Basic Operations

Query Scopes

Modes

Insert Mode (Default)

Creates a new approval record for each status change. Ideal for history tracking and audit trails.

Configure in your config/approvals.php:

Usage:

Upsert Mode

Updates existing approval record. Ideal for keeping single record and current status only.

Configure in your config/approvals.php:

Usage:

Note: Mode can be configured per model in the config file.

Smart Rejection Handling

The reject() method stores configured reasons directly and normalizes unknown reasons to other:

Validation Rules:

Global Scope

auto_scope and show_only_approved_by_default do different jobs:

When both are enabled, only approved records are visible by default:

The scope is registered for approvable models only when approvals.default.auto_scope is enabled:

If auto_scope is disabled, you can still apply the scope manually when needed:

Auto Pending

Automatically set to pending status when model is created. Configure in your config/approvals.php:

Usage:

Model-Specific Configuration

Override default settings for specific models in your config/approvals.php. Only specify the settings you want to override:

πŸ”” Events

Listen to events on status changes. The package provides 6 different events with rich context:

Available Events

Before persistence:

After persistence:

ModelSettingPending is dispatched after the pending approval record is saved and immediately before ModelPending.

Event Usage

Event Configuration

Configure events globally or per model in your config/approvals.php:

Configurable actions can be invokable classes:

Closures are not config-cache-safe, so use class strings here instead.

Event Properties

Event payloads are intentionally not identical across all six events:

🎭 Facade Usage

πŸ–₯️ Artisan Commands

Command Output Examples

All Models Statistics: +-------------------+-------+----------+--------+----------+-------------+ | Model | Total | Approved | Pending| Rejected | Approved % | +-------------------+-------+----------+--------+----------+-------------+ | App\Models\Post | 100 | 75 | 15 | 10 | 75.00% | | App\Models\Comment| 50 | 40 | 5 | 5 | 80.00% | +-------------------+-------+----------+--------+----------+-------------+

Single Model Statistics: +----------+-------+------------+ | Metric | Count | Percentage | +----------+-------+------------+ | Total | 100 | 100% | | Approved | 75 | 75.00% | | Pending | 15 | 15.00% | | Rejected | 10 | 10.00% | +----------+-------+------------+ bash composer test

tests/ β”œβ”€β”€ ArchTest.php # Architecture tests β”œβ”€β”€ Commands/ # Artisan command tests β”œβ”€β”€ Core/ # Core service tests β”œβ”€β”€ Events/ # Event class tests β”œβ”€β”€ Exceptions/ # Exception tests β”œβ”€β”€ Facades/ # Facade tests β”œβ”€β”€ Integration/ # Integration tests β”œβ”€β”€ Listeners/ # Listener tests β”œβ”€β”€ Models/ # Model tests β”œβ”€β”€ Services/ # Service tests β”œβ”€β”€ Traits/ # Trait tests β”œβ”€β”€ ExampleTest.php └── TestCase.php



## πŸ“ Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## 🀝 Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

## πŸ”’ Security Vulnerabilities

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

## πŸ‘¨β€πŸ’» Credits

- [Fatih Zengin](https://github.com/fzengin19)
- [All Contributors](../../contributors)

## πŸ“„ License

This package is licensed under the MIT License. See [LICENSE.md](LICENSE.md) for details.

All versions of laravel-approval with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
spatie/laravel-package-tools Version ^1.16
illuminate/contracts 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 fzengin19/laravel-approval contains the following files

Loading the files please wait ...