Download the PHP package mattkingshott/triggers without Composer

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

Triggers

This package enables the use of database triggers within Laravel applications. Note that your chosen database must support triggers for the package to work.

Installation

Pull in the package using Composer:

Usage

Triggers can only be added to existing tables. Therefore, when creating triggers in your migration files, make sure you add them after the Schema::create method.

Table

To create a trigger, simply call the table method on the Triggers\Trigger class:

Key

By default, the class will generate a name for the trigger using the following convention:

However, since trigger names must be unique across the database, if you were to create two triggers that used the same event and time (these concepts are covered in the next section), then you'd get an error.

To address this problem, the class offers a key method that allows you to add your own custom text to the trigger's name, thereby ensuring that the trigger name can be made unique:

When a key is specified, the trigger name is derived from the following convention:

Event and time

Next, you need to specify whether the trigger should be fired for an INSERT, UPDATE or DELETE event. You will also need to specify whether the trigger should run BEFORE or AFTER the event has taken place:

Statement

The final step, is to specify the SQL statement(s) that should be executed by the trigger when it is fired. To do this, supply a Closure to the event / time method. Note that the Closure must return a SQL string e.g.

Example

The following example shows a migration that creates a posts table and then assigns the trigger to it.

Contributing

Thank you for considering a contribution to the project. You are welcome to submit a PR containing improvements, however if they are substantial in nature, please also be sure to include a test or tests.

License

The MIT License (MIT). Please see License File for more information.


All versions of triggers with dependencies

PHP Build Version
Package Version
Requires php Version ^8.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 mattkingshott/triggers contains the following files

Loading the files please wait ....