Download the PHP package agencelex/notifications without Composer

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

lex_notifications — TYPO3 Notification System

TYPO3 13.4 TYPO3 14 PHP 8.2+ License: GPL-2.0-or-later Version

A Laravel-style notification system for TYPO3. Any PHP class can send a notification to any object that uses the Notifiable trait — through any combination of channels (email, database, Slack, …).

There is no constraint on the direction: a frontend user can notify another frontend user, an extension can alert a backend user, a Scheduler task can email an address with no domain model at all. If it uses Notifiable, it can receive notifications.

A backend module (Web > Notifications) is included for editors who need to compose and send messages to frontend users. It also serves as a reference implementation for dispatching batch notifications from PHP code.


Requirements

Dependency Version
TYPO3 CMS ^13.4 || ^14
PHP ^8.2
nesbot/carbon ^3.2
illuminate/collections ^12.69

Installation


Quick Start

1. Make any class a notification recipient (optional)

2. Create a notification

3. Send it


Who Can Be a Recipient?

Any object that uses the Notifiable trait — regardless of class hierarchy:


On-Demand Notifications

Sometimes the recipient is not a model at all: a guest who left an email address, a support mailbox, a Teams room. Instead of writing a throwaway class, ask the NotificationManager for an anonymous notifiable and give it a route for each channel:

route() and routes() return a Lex\Notifications\AnonymousNotifiable. It uses the Notifiable trait, so notify() (queued if ShouldQueue) and notifyNow() (immediate) work as usual, and so does $this->notificationDispatcher->send($anonymous, ...).

Things to know:

Custom channels should read the route with $notifiable->routeNotificationFor('<channel>', $notification). That works for both anonymous notifiables and models: on a model, the Notifiable trait forwards the call to routeNotificationFor<Channel>() (e.g. routeNotificationForSlack()).


Channels

Two built-in channels are included:

Key Class Description
mail EmailChannel HTML/plain-text email via TYPO3 mail system
database DatabaseChannel Persisted in-app notifications via Extbase

Adding a Custom Channel

Implement ChannelInterface — the channel is automatically registered with no additional configuration required:

Then return the key from via():

Then implement the route method in each notifiable that could be notified through this channel:

If that route is missed, the system will skip the channel when sending the notifications to the notifiable.

The NotificationManager resolves the channel by its key at send time. To ensure a custom channel is properly detected and registered into the manager's iterator, you must assign the notifications.channel tag to your class.

You can achieve this in one of three ways:

1. Declaration in Services.yaml

Add your concrete channel class manually with the required tag in your extension's Configuration/Services.yaml:

2. Using #[AutoconfigureTag] in the channel class (Recommended)

Keep your YAML file clean by adding the Symfony attribute directly above your class definition:

3. Using #[Autoconfigure] in the channel class

If you need to change other service options (like visibility) while registering the tag, you can pass the tags directly into the #[Autoconfigure] attribute:


Queue Support

Implement the ShouldQueue marker interface to dispatch via Symfony Messenger:

Run the worker:

Call notifyNow() / sendNow() to bypass the queue at any time.


Notification Levels (RFC 5424)

Constant Value
NotificationLevel::LEVEL_INFO 0
NotificationLevel::LEVEL_NOTICE 1
NotificationLevel::LEVEL_WARNING 2
NotificationLevel::LEVEL_ERROR 3
NotificationLevel::LEVEL_CRITICAL 4
NotificationLevel::LEVEL_ALERT 5
NotificationLevel::LEVEL_EMERGENCY 6

Backend Module

Web > Notifications lets editors:

The module source (Classes/Controller/Backend/NotificationController.php) is intentionally simple and can be used as a reference for dispatching batch notifications from PHP code.


Reading In-App Notifications


Development


Running the Tests

The extension ships two test suites:

Suite Location What it covers
Unit Tests/Unit/ Manager, channels, traits, models, queue handler. No TYPO3 instance.
Functional Tests/Functional/ A real TYPO3 instance: DI wiring, email delivery, database storage, queue handler, repositories, custom channels registered by another extension, and every public way of sending a notification.

The functional tests load a fixture extension (Tests/Functional/Fixtures/Extensions/notifications_test). It plays the role of a third-party integrator: it registers custom channels and captures sent emails in memory, so no mail is ever sent. By default they use SQLite, so no database server is needed.

Without DDEV

Requires PHP 8.2+ (with pdo_sqlite) and Composer, run from the extension directory:

Composer cannot install the dependencies on an exFAT volume (plugin installation fails). Use an APFS/ext4 disk, or DDEV.

With DDEV

The extension directory contains a DDEV configuration:

The functional tests create one database per test class (prefixed with typo3DatabaseName), so the database user needs CREATE DATABASE privileges. That's why the example uses root.

Useful options

Any other database can be used through the typo3DatabaseDriver, typo3DatabaseHost, typo3DatabasePort, typo3DatabaseUsername, typo3DatabasePassword and typo3DatabaseName environment variables.


Documentation

Full documentation: https://docs.typo3.org/p/agencelex/notifications/1.4/en-us/


License

GPL-2.0-or-later — see LICENSE.

Author

Agence Lex


All versions of notifications with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
typo3/cms-core Version ^13.4 || ^14.3
nesbot/carbon Version ^3.2
illuminate/collections Version ^12.69
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 agencelex/notifications contains the following files

Loading the files please wait ...