Download the PHP package cmatosbc/clotho without Composer

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

Clotho - PHP Event Attribute Library

PHP Version License

Why Clotho?

In Greek mythology, Clotho (meaning "spinner") was one of the three Fates, or Moirai. She was responsible for spinning the thread of human life, determining when pivotal events would occur. Just as Clotho spun the threads that would become significant moments in one's life, this library helps you weave together the events that shape your application's behavior.

Overview

Clotho is a modern, attribute-based event system for PHP 8.1+. It provides a powerful and intuitive way to handle events in your application using PHP attributes. The library is PSR-14 compliant and offers features like:

Installation

Basic Usage

For more detailed examples and use cases, check out the examples/ folder in this repository.

1. Simple Event Handling

2. Priority-based Execution

3. Wildcard Event Patterns

4. Event Groups

5. Event Propagation Control

Event Objects and Payload

Clotho supports both event objects and named events with payloads. When using attributes, both types are dispatched:

Advanced Features

Event Objects

Clotho provides dedicated event objects for different scenarios:

Priority-based Event Handling

Events can be handled with different priorities, where higher priority listeners execute first:

Event Propagation Control

All event objects implement StoppableEventInterface, allowing you to control event propagation:

Error Handling

Clotho provides a set of custom exceptions for handling error conditions in the event system. These exceptions are used only for truly exceptional cases, not for normal flow control.

Exception Types

Normal Flow Control

The following scenarios are handled as normal flow control, not exceptions:

Exception Hierarchy

Event Payload Structure

When using named events, Clotho dispatches an array with the following structure:

Before Method Events

After Method Events

Before Function Events

After Function Events

Example usage with payload:

Best Practices

  1. Event Naming:

    • Use lowercase, dot-separated names
    • Start with module/context (e.g., user., order.)
    • Use verbs for actions (e.g., create, update)
    • Use colons for groups (e.g., admin.group:create)
  2. Priority Levels:

    • 20+ : Critical operations (validation, security)
    • 10-19: Core business logic
    • 0-9: Logging, notifications, non-critical operations
  3. Event Payload:
    • Keep payloads serializable
    • Include only necessary data
    • Consider security implications

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Acknowledgments


Built with ❤️ by Carlos Artur Matos


All versions of clotho with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
psr/event-dispatcher Version ^1.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 cmatosbc/clotho contains the following files

Loading the files please wait ....