PHPackages                             sammakescode/actions - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. sammakescode/actions

AbandonedLibrary[Validation &amp; Sanitization](/categories/validation)

sammakescode/actions
====================

A standardised way to perform actions

v1.0.0(1y ago)09MITPHPPHP &gt;=8.2

Since Jun 20Pushed 1y ago1 watchersCompare

[ Source](https://github.com/SamMakesCode/actions)[ Packagist](https://packagist.org/packages/sammakescode/actions)[ Docs](https://github.com/sammakescode/actions)[ RSS](/packages/sammakescode-actions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Actions
-------

[](#actions)

Introduction
============

[](#introduction)

This library is designed to facilitate contained, repeatable actions you might use throughout your application and enforce business rules on those actions.

Example use case
----------------

[](#example-use-case)

A hypothetical application might want to - for various reasons and in various places - cancel an order. In order to prevent duplication of logic, a developer might create something like a class called "CancelOrder" that defines that logic.

This library formalises that process and allows you to attach business logic to it. For example, if it's never possible to cancel an order that's been dispatched, you can define that logic within your action.

Requirements
============

[](#requirements)

- [Composer](https://getcomposer.org/)
- PHP 8.2 or later

Installation
============

[](#installation)

```
composer require sammakescode/actions

```

Usage
=====

[](#usage)

You can have a look at the `tests` directory for some examples, but here's a quick on your can have a look at.

Example
-------

[](#example)

### Define your business rules

[](#define-your-business-rules)

```
