- How does cleentfaar/mailer compare to Laravel’s built-in Mail facade for sending emails?
- This package extends Laravel’s native Mail facade with a more streamlined API for template rendering and transport configuration. It maintains compatibility with Laravel’s Mailable classes and queue system but adds flexibility for custom transports (e.g., SendGrid, Mailgun) and hybrid Markdown/HTML emails without requiring additional packages like Spatie’s laravel-mail.
- Can I use Blade templates with cleentfaar/mailer, and where should I store them?
- Yes, the package supports Blade templates natively. Store them in the standard Laravel directory `resources/views/emails/` or externalize them via filesystem or database if needed. The package follows Laravel’s conventions for template resolution, so no extra configuration is required for basic use.
- Does cleentfaar/mailer support async email sending via Laravel Queues?
- Absolutely. The package integrates with Laravel’s queue system out of the box. You can dispatch emails as queueable jobs using `ShouldQueue`, and it works with all Laravel-supported queue drivers (database, Redis, etc.). This is ideal for high-traffic applications to avoid blocking HTTP responses.
- What email transports does cleentfaar/mailer support, and can I switch providers easily?
- The package supports SMTP, API-based providers (e.g., SendGrid, Mailgun), and custom transports. Switching providers is straightforward—just update the configuration in `.env` or the service provider. The abstraction layer ensures minimal code changes when migrating between services like Postmark or AWS SES.
- How do I mock cleentfaar/mailer for testing in Laravel?
- The package provides a mockable `MailerInterface`, allowing you to replace the real mailer with a fake implementation in unit or feature tests. Use Laravel’s built-in `MailFake` or manually create a mock to verify email content, attachments, and recipients without sending real emails. This works seamlessly with PHPUnit or Pest.
- Is cleentfaar/mailer compatible with Laravel 10, and what PHP versions does it support?
- Check the package’s `composer.json` for the latest Laravel version support, but it typically aligns with Laravel’s LTS releases. As of now, it likely supports Laravel 9+ and PHP 8.1+. Always verify compatibility with your Laravel version to avoid integration issues, especially if using newer features like attributes or first-party packages.
- Can I use cleentfaar/mailer alongside Spatie’s laravel-mail or other email packages?
- While the package is designed to be a standalone solution, it can coexist with other email packages if configured carefully. However, mixing packages may lead to conflicts in service bindings or template resolution. For most use cases, cleentfaar/mailer is a lighter alternative to Spatie’s package, offering similar features without the overhead.
- How do I handle dynamic email content or attachments with cleentfaar/mailer?
- Dynamic content is handled via Blade templates, where you pass variables to the template just like in Laravel views. Attachments can be added via the `attach()` method, supporting files, strings, or even dynamically generated content (e.g., PDFs). For complex scenarios, the package’s extensible design allows you to create custom renderers or attachment handlers.
- Does cleentfaar/mailer support Markdown emails, and how do I configure it?
- Yes, the package supports Markdown emails through customizable rendering pipelines. You can configure it to convert Markdown to HTML using Laravel’s built-in Markdown support or integrate third-party libraries like Parsedown. This is useful for maintaining cleaner email templates while ensuring consistent rendering across clients.
- What are the potential performance implications of using cleentfaar/mailer in production?
- The package is optimized for performance, leveraging Laravel’s underlying mail system. For high-volume sending, ensure your queue worker processes are scaled appropriately. Benchmark against Laravel’s native mailer if you’re sending thousands of emails per minute, as the package’s abstraction layer adds minimal overhead. Always monitor queue backlogs and transport latency.