tparcina/qsendgridbundle
A PHP bundle that integrates SendGrid email delivery into your application, letting you configure API credentials and send transactional messages through SendGrid from a single package.
Install the package via Composer (composer require vendor/package) and, if the package ships a config file, publish it with php artisan vendor:publish --tag=attachments-config (check the README for the exact tag). Laravel 5.5+ will auto-discover the service provider; older versions require manual registration in config/app.php.
Start by reading the package’s README and the published config file (typically config/attachments.php). The config usually defines the default storage disk, allowed MIME types, and default naming behaviour. The first practical use case is attaching a file to a Mailable and giving it a human‑friendly name:
// In a Mailable's build() method
$this->attach(storage_path('app/invoices/123.pdf'))
->as('Invoice-123.pdf'); // new in 1.1.1
If the package uses a fluent API, look for an as() method or a name option in the attach call. The 1.1.1 release adds the ability to define the attachment name explicitly, so verify the exact signature in the updated docs—most packages accept either attach($path, ['as' => 'name.pdf']) or a chainable ->as('name.pdf').
build() or toMail(). The new naming feature is most useful when attaching generated documents (invoices, reports) so recipients see a meaningful filename instead of a random hash.Storage::disk('local')->put(...)), attach it with a custom name, then delete the file after sending. For queued mail, ensure the disk persists until the job runs.{type}-{id}.pdf) to avoid collisions.attachData() with a name if the package supports it, or store files on a persistent disk. The naming feature works the same in queued and synchronous mail.Mail::fake() and assert that the Mailable contains an attachment with the expected name. Check the package’s testing helpers or inspect the raw MIME if needed.php artisan config:clear to avoid stale settings, especially when switching storage disks.Content-Disposition header.AttachmentCreating) or allow custom resolvers. Use these to apply naming rules globally without touching every Mailable.local disk if it’s ephemeral in your environment. Use a disk that survives until the queue worker processes the job.How can I help you explore Laravel packages today?