Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 17, 2024 via composer

symfony/messenger v7.0.1

Helps applications send and receive messages to/from other applications or via message queues
Package summary
Share
0
issues
1
license
6
MIT
Package created
23 Mar 2018
Version published
30 Nov 2023
Maintainers
1
Total deps
6
Direct deps
2
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
6 Packages, Including:
psr/clock@1.0.0
psr/log@3.0.0
symfony/clock@v7.0.7
symfony/messenger@v7.0.1
symfony/polyfill-php80@v1.29.0
symfony/polyfill-php83@v1.29.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

2
All Dependencies CSV
β“˜ This is a list of symfony/messenger 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
psr/log3.0.06.77 kBMIT
prod
symfony/clockv7.0.7-MIT
prod

Visualizations

Frequently Asked Questions

What does symfony/messenger do?

The Symfony Messenger is a powerful component that aids applications in sending and receiving messages to and from other applications or through message queues. It is particularly helpful in the handling of tasks asynchronously or where inter-application communication is required, enhancing the performance, efficiency and scalability of the overall application.

How do you use symfony/messenger?

To use the Symfony Messenger in your PHP application, you'll first have to install it through composer. You can do that by running the following command in your terminal:

composer require symfony/messenger

After installation, you can dispatch messages by creating a message class and a message handler and then dispatching your message. Let's create an UpdateUserPreferences message as an example:

namespace App\Message;

class UpdateUserPreferences
{
    private $userPreferences;

    public function __construct(array $userPreferences)
    {
{
        $this->userPreferences = $userPreferences;
    }

    public function getUserPreferences(): array
    {
        return $this->userPreferences;
    }
}

Now, we create a UpdateUserPreferencesHandler:

namespace App\MessageHandler;

use App\Message\UpdateUserPreferences;

class UpdateUserPreferencesHandler
{
    public function __invoke(UpdateUserPreferences $updateUserPreferences): void
    {
        // Do some logic with $updateUserPreferences
    }
}

With Symfony Messenger installed and the message and handler created, you can then dispatch the message in your application:

namespace App\Controller;

// Make sure to import the necessary namespaces
use App\Message\UpdateUserPreferences;
use Symfony\Component\Messenger\MessageBusInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;

class SomeController extends AbstractController
{
    private $bus;

    public function __construct(MessageBusInterface $bus)
    {
        $this->bus = $bus;
    }

    public function someAction()
    {
        $userPreferences = ['key' => 'value'];

        // The message will be handled asynchronously and the process will continue
        $this->bus->dispatch(new UpdateUserPreferences($userPreferences));
    }
}

Remember, this is a basic example. Using Symfony's Messenger component with routing, transports and middleware can provide a powerful way of handling and dispatching messages.

Where are the symfony/messenger docs?

For a more comprehensive understanding of how Symfony Messenger works, refer to the official Symfony Messenger Documentation. The documentation provides an in-depth look into the component, including how to use it, configure it, and extend it according to your application's requirements. You can also contribute to the project through issues and pull requests on the Symfony GitHub repository.