Download the PHP package samsin33/laravel-decision-engine without Composer

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

Introduction

Decision Engine package for laravel. This package provide support for making decision engine in laravel version 9.

Installation

Just install samsin33/laravel-decision-engine package with composer.

Database Migration

Decision Engine service provider registers its own database migration directory, so remember to migrate your database after installing the package. The migrations will add 3 tables to your database:

If you need to overwrite the migrations that ship with this package, you can publish them using the vendor:publish Artisan command:

If you would like to prevent Decision Engine's migrations from running entirely, you may use the ignoreMigrations method provided by DecisionEngine. Typically, this method should be called in the register method of your AppServiceProvider:

Publish Config

If you need to overwrite the config file that ship with this package, you can publish them using the vendor:publish Artisan command:

Env Configuration

You can change your database connection for models, default will be your DB_CONNECTION if not then mysql. If you wish to change this you can specify a different connection in your .env file:

You can change your database primary key type for models, default is bigInt. If you wish to change this to uuid you can specify it in your .env file.

For now only bit integer and uuid is supported.

Publish Views

You need to overwrite the view files that ship with this package and can change according to your design, you can publish them using the vendor:publish Artisan command:

Showing and Creating Rule Engine

For index page and create page of Rule Engine goto routes

You can add these routes to your menu to access them. All the required routes are already registered.

Rule Engine Types

For now this package supports only 2 types of Rule Engine.

  1. Code - Set of code will be executed which u will put in business rules column on the basis of the input you provide.
  2. Command - A command will be executed which u will put in business rules column on the basis of the input you provide.

Route Guards

Your web routes are contained inside web_guards. Your api routes are contained inside api_guards. You can change them in config files.

Example - Making a calculator

As an example lets a make a calculator.

Create a rule engine:

Name - Calculator

Type - Code

Validation - This should be an array of validation rules of your input. E.g. You can also make your own validations and use.

Business Rules - This should be the code which runs when the validation will pass.

Status - It should be active for rule execution.

Your business rules should always return a value to show an output.

For a command example. Make a command Calculator with:

signature - calc {num1} {num2} {process}

and in the Business Rules field should be:

Business Rules - calc $num1 $num2 $process

the output of command type has 2 attributes result and info

result - returns integer from command.

info - save the output of the command, i.e. anything printed in line, info, comment, question, warn, and error methods.

Executing Business Rules on input

To execute business rules you need to call the api.

Note

  1. Input should be associative array.
  2. Your input keys will be converted to variables in the business rules value.

All versions of laravel-decision-engine with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-json Version *
guzzlehttp/guzzle Version ^7.2
illuminate/log Version ^9.0
illuminate/notifications Version ^9.0
illuminate/routing Version ^9.0
illuminate/view Version ^9.0
illuminate/console Version ^9.0
illuminate/container Version ^9.0
illuminate/contracts Version ^9.0
illuminate/cookie Version ^9.0
illuminate/database Version ^9.0
illuminate/encryption Version ^9.0
illuminate/http Version ^9.0
illuminate/support Version ^9.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 samsin33/laravel-decision-engine contains the following files

Loading the files please wait ....