Remove Abandoned Laminas Packages and Suggest Alternatives
This PR removes the abandoned Laminas packages (laminas-db, laminas-mail, laminas-log) from the project and suggests replacing them with other alternatives such as monolog/monolog and symfony/mailer. Users of the package can select any logger implementation based on psr/log and use Monolog handlers to get email functionality based on Symfony Mailer instead of relying on the Laminas packages.
Changes:
-
Remove Laminas Packages:
- [X] Removed
laminas-db,laminas-mail, andlaminas-logfromcomposer.json.
- [X] Removed
-
Update Configuration:
- [X] Updated the configuration files to use
monolog/monologandsymfony/mailer.
- [X] Updated the configuration files to use
-
Instructions for Users:
- [ ] Add instructions for users to select any logger implementation based on
psr/logand use Monolog handlers for email functionality.
- [ ] Add instructions for users to select any logger implementation based on
Detailed Changes:
-
composer.json:{ "require": { "php": "~8.2.0 || ~8.3.0 || ~8.4.0", "laminas/laminas-diactoros": "^2.26 || ^3.5.0", "psr/log": "^1.1 || ^2.0", }, "require-dev": { "doctrine/doctrine-orm-module": "^4.2.1 || ^5.3 || ^6.0", "laminas/laminas-coding-standard": "^3.0", "laminas/laminas-servicemanager": "^3.23 || ^4.0", "monolog/monolog": "^3.9", "symfony/mailer": "^7.2" }, "suggest": { "monolog/monolog": "Sends your logs to files, sockets, inboxes, databases and various web services", "symfony/mailer": "Symfony's Mailer & Mime components form a powerful system for creating and sending emails" }, } -
php/ErrorHeroModule/config/module.config.php:use Monolog\Logger; use Monolog\Handler\StreamHandler; use Psr\Log\LoggerInterface; return [ 'service_manager' => [ 'factories' => [ 'ErrorHeroModuleLogger' => function (): LoggerInterface { $logger = new Logger('error-hero-module'); $logger->pushHandler(new StreamHandler('path/to/your.log', Logger::DEBUG)); return $logger; }, ], ], ]; -
Instructions for Users:
- To use different logger implementations, ensure it implements
psr/log. - For email functionality, configure Monolog handlers with Symfony Mailer:
use Monolog\Logger; use Monolog\Handler\SymfonyMailerHandler; use Symfony\Component\Mailer\Mailer; use Symfony\Component\Mailer\Transport; use Symfony\Component\Mime\Email; $transport = Transport::fromDsn('smtp://localhost'); $mailer = new Mailer($transport); $message = (new Email()) ->from('[email protected]') ->to('[email protected]') ->subject('Error Notification') ->text('An error occurred.'); $logger = new Logger('error-hero-module'); $logger->pushHandler(new SymfonyMailerHandler($mailer, $message, Logger::ERROR));
- To use different logger implementations, ensure it implements
Testing:
- [ ] Ensure the application works correctly with the new logger and mailer configurations.
- [ ] Verify that error logging and email notifications function as expected.
Note:
- Users should update their
composer.jsonand configuration files accordingly. - Detailed documentation on configuring Monolog and Symfony Mailer can be found in their respective documentation.
Closing: This PR aims to modernize the package by removing dependencies on abandoned Laminas packages and providing more flexible and widely-used alternatives and support the latest versions of PHP. It also reduces the complexity of the package itself.