PHPackages                             karamvirs/here-trigger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. karamvirs/here-trigger

ActiveLibrary

karamvirs/here-trigger
======================

:package\_description

04PHP

Since Oct 4Pushed 4y agoCompare

[ Source](https://github.com/karamvirs/here-trigger)[ Packagist](https://packagist.org/packages/karamvirs/here-trigger)[ RSS](/packages/karamvirs-here-trigger/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

HereTrigger
===========

[](#heretrigger)

[![Latest Version on Packagist](https://camo.githubusercontent.com/b5b9cb3cb23688a48c49a804715d269e1bc7f2c75b08760ecd96307f7c337d3e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b6172616d766972732f686572652d747269676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/karamvirs/here-trigger)[![Total Downloads](https://camo.githubusercontent.com/064560b9ea2444b39071be659945edc304ce5dca68826ff098ecafd5737ec4c7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b6172616d766972732f686572652d747269676765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/karamvirs/here-trigger)[![Build Status](https://camo.githubusercontent.com/d779a87507a377f5c46451090c7375f0725af7066646666d423ac7717fdcb3e9/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6b6172616d766972732f686572652d747269676765722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/karamvirs/here-trigger)[![StyleCI](https://camo.githubusercontent.com/cb13a877afd1dbe223c631789c3f922d3ace958fdb334a9cce9b26afefbc2ebd/68747470733a2f2f7374796c6563692e696f2f7265706f732f31323334353637382f736869656c64)](https://styleci.io/repos/12345678)

The package provides a convenient way to define complex rules to conditionally process certain actions triggered from any part of your Laravel application.

Examples:

- evaluate certain rules everytime an order is processed on an ecommerce site and if true, send promotion emails, discount coupons etc.
- Whenever a new credit report is available on a credit management service, evaluate if customer should be moved to a different group.

Installation
------------

[](#installation)

Via Composer

```
$ composer require karamvirs/here-trigger

$ php artisan vendor:publish --provider="Karamvirs\HereTrigger\HereTriggerServiceProvider"
```

Overview
--------

[](#overview)

Anywhere in your application, you disptach the HereTriggerProcessor job with a trigger name and a data array.

```
...
...
use App\Jobs\HereTriggerProcessor;
...
...
HereTriggerProcessor::disptach('new_order', ['user' => , 'order' => ])
...
...

```

NOTE: data array must contain all data objects that will be used in the filters defined in the config. The key names must match the key names defined under the filters section in the here-trigger config

When the job is processed, the code looks at the config file (here-trigger.php) and retrieves the actions for this trigger. In our example config they are: \['high\_value\_customer', 'young\_international\_customer'\]

The rule expression for each action (under the 'actions' key in the config) is evaluated, and if true, jobs specified under processors are dispatched.

How it works
------------

[](#how-it-works)

When you run the vendor:publish command, following 3 files are published:

- config/here-trigger.php
- app/Helpers/HereTriggerHelper.php
- app/Jobs/HereTriggerProcessor.php

Let us discuss them one by one.

### config/here-trigger.php

[](#confighere-triggerphp)

***helper\_class***

sets the path to the helper class that defines all filter value functions. Feel free to change it in case you want to move the HereTriggerHelper file to elsewhere.

***filters***

contain the entities or data objects whose properties will be evaluated for conditions defined under the action rules. In the default Example, you will see there are 3 entries under filters: user, order, wishlist

Each entity in under the filters has a filtername, the actual filter and the function name that evaluates the value for that filter.

Ex:

```
'total_spent_till_date_more_than_1500' => ['filter' => ['total_spent_till_date', operators::GREATER_THAN, 1500], 'value_function' => 'userTotalSpendTillDate'],

```

*total\_spent\_till\_date\_more\_than\_1500* - is the filter name which is referred to in the rule expression under the actions.

*'filter' =&gt; \['total\_spent\_till\_date', operators::GREATER\_THAN, 1500\]* - defines the actual filter. Here it says, the total amount spent by the user should be greater than 1500.

*'value\_function' =&gt; 'userTotalSpendTillDate'* - tells the function name which you will define in the helper file (HereTriggerHelper.php) and will be used to calculate the value of this property (total\_spent\_till\_date, in this case.) If a value function is not specified, then it is assumed that the property is directly accessible on the passed object.

***actions***

Actions contain a rule and an array of processors

rule is an expression that must evaluate to true for the processors to run. Expression can have brackets but same types of brackets cannot be nested. That means you can use : \[ xyz &amp;&amp; { abc OR (mno &amp;&amp; pqr)}\] but you cannot use: {xyz {abc }}

The terms in the expression are actual filter names defined in the filters section.

'processors' is an array of Jobs you will define, which will contain the code to be executed when the rule evaluates to true.

Example config mentions 2 such jobs, but doesnt impplement them: App\\Jobs\\Send15PercentDiscount App\\Jobs\\HighValueNotification

Change log
----------

[](#change-log)

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

Contributing
------------

[](#contributing)

Please see [contributing.md](contributing.md) for details and a todolist.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

License
-------

[](#license)

MIT. Please see the [license file](license.md) for more information.

###  Health Score

15

—

LowBetter than 3% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/62ff201a3150b214a424b882b00f4f3f509c2728583c2611c1fae23cb60f5abc?d=identicon)[karamvirs](/maintainers/karamvirs)

---

Top Contributors

[![karamvirs](https://avatars.githubusercontent.com/u/3183185?v=4)](https://github.com/karamvirs "karamvirs (7 commits)")

### Embed Badge

![Health badge](/badges/karamvirs-here-trigger/health.svg)

```
[![Health](https://phpackages.com/badges/karamvirs-here-trigger/health.svg)](https://phpackages.com/packages/karamvirs-here-trigger)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
