Download the PHP package my-com/laravel-conditional-actions without Composer

On this page you can find all versions of the php package my-com/laravel-conditional-actions. 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-conditional-actions

Conditional Actions

Build Status

This package allows configuring business logic by API without changing your code. This is helpful when you don`t know specific conditions because they defined dynamically by your managers/users/etc.

How it works

Codebase provides predefined conditions, actions, targets and API for mix them into business logic to end users. Objects:

Lifecycle:

Get started

For example, you have a shop that sells toys. Your marketing runs some promotions for specific toys. If a user buys chests in the past or today is his birthday, "Barbie doll" should have a 10% discount. Promotion starts at 2019/05/01 at 00:00 and finishes at 2019/05/01 at 23:59.

You should create:

Conditions:

Action:

For time restrictions (Promotion starts at 2019/05/01 00:00 and finishes at 2019/05/01 23:59) you can use fields starts_at and ends_at.

Both conditions should be succeeded. You can use AllOfCondition condition from the package.

Marketing can use it for promotions without changing your code.

The final scheme for promotion:

Let`s go to implementation!

Install package

Laravel

For versions < 5.5:

Add package service provider to config/app.php:

For laravel >= 5.5

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider

Lumen

Register service provider and config in app.php:

Add migrations

Command options:

Implement Target

Target is an object that provides all necessary data for conditions and actions. It can be also an eloquent model.

Since Toy - object for conditional actions, it should use EloquentTarget trait (trait has relationships and some method to get conditions for model)

Implement conditions

Each condition should implement ConditionalActions\Contracts\ConditionContract contract. The package has a base abstract class ConditionalActions\Entities\Conditions\BaseCondition with all contract methods except the check method.

Implement action

Each condition should implement ConditionalActions\Contracts\ActionContract contract. The package has a base abstract class ConditionalActions\Entities\Actions\BaseAction with all contract methods except the apply method.

Add conditions to config config/conditional-actions.php

Implement API for adds conditions and actions for Toy model

You can use eloquent models or any other objects to put business logic into external storage.

The package has basic CRUD for conditions and actions. You can enable it:

Or you can implement your own API. Sample example:

Run conditional actions

P.S.

The package includes conditions and actions:

Both conditions and actions have fields:


All versions of laravel-conditional-actions with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ^6.0
illuminate/database Version ^6.0
illuminate/config Version ^6.0
illuminate/http Version ^6.0
ext-json Version *
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 my-com/laravel-conditional-actions contains the following files

Loading the files please wait ....