Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Mailjet Apiv3 Php

Mailjet Apiv3 Php Laravel Package

mailjet/mailjet-apiv3-php

Official PHP wrapper for the Mailjet API v3. Send transactional email and SMS, manage contacts and campaigns through a simple, PSR-18 compatible client. Requires PHP 8.1+ and installs easily via Composer.

View on GitHub
Deep Wiki
Context7

Mailjet PHP Wrapper is the official PHP client for the Mailjet API, enabling developers to send transactional email and SMS, manage contacts, and access Mailjet resources directly from PHP applications. It requires PHP 8.1+ and integrates with any PSR-18 HTTP client and PSR-17 factories, auto-installing a compatible default via Composer if needed.

  • Simple API key authentication with configurable API version and base URL
  • Full CRUD support (GET, POST, PUT, DELETE) with filtering and actions
  • Built-in SMS API with token authentication
  • API resource helpers for cleaner request building
  • Optional disable API call mode for testing
composer require mailjet/mailjet-apiv3-php
Frequently asked questions about Mailjet Apiv3 Php
What is mailjet/mailjet-apiv3-php?
It is the official Mailjet PHP wrapper for the Mailjet API v3, maintained by Mailjet and released under the MIT license. It provides a lightweight, resource-based client for sending transactional email and SMS and for managing contacts, lists, and campaigns. The package requires PHP 8.1+ and relies on a PSR-18 HTTP client with PSR-17 factories, which Composer can auto-discover via php-http/discovery. It is a low-level API gateway, not a full Laravel mail transport.
How do I install mailjet/mailjet-apiv3-php in a Laravel app?
Run composer require mailjet/mailjet-apiv3-php; PHP 8.1+ matches Laravel 10, 11, and 12 requirements. There is no Laravel service provider, config file, or facade, so you must bind the Client in your own container configuration. On Composer 2.2+ and in CI images, allow the php-http/discovery plugin in composer.json or the first install can fail. Require a specific PSR-18 client such as Guzzle if you do not want discovery to choose one.
Does this package work with Laravel Mail and Mailable classes?
No. Laravel has no first-party Mailjet transport, and this package is a Mailjet API client rather than a Symfony Mailer or Laravel Mail transport. You can call the SDK from queued jobs, or build a Symfony\Component\Mailer\Transport adapter so existing Mailables keep working. That transport decision is the main design choice to make before implementation. Isolate the SDK behind a first-party interface either way.
Which PHP and Laravel versions support mailjet/mailjet-apiv3-php?
The wrapper requires PHP 8.1 or higher, which aligns with Laravel 10, 11, and 12. It has no native extensions or build step and is framework-agnostic, so it can be used outside Laravel too. You need a PSR-18 HTTP client and PSR-17 request/stream factories; php-http/discovery can supply defaults. Check your application's PSR-18 client compatibility if you pin Guzzle or another implementation.
How do I authenticate with the Mailjet API using this wrapper?
Email API calls use a Mailjet API key and secret passed to the Client constructor. The SMS API uses a separate Bearer token, so SMS requires a second client instance and credential set. Store both credential sets in environment variables or a secrets manager and never commit them. Scope SMS separately from email if you want to reduce failure surfaces in phase one.
How do I configure timeouts, proxies, or a mock HTTP client?
Version 2.0.0 delegates HTTP transport to PSR-18 clients and PSR-17 factories, which are auto-discovered when absent. You can inject a configured client to set timeouts, proxies, IPv4 forcing, logging decorators, or an Http\Mock\Client for tests. The Client uses a multi-argument positional constructor, so Laravel will not auto-resolve it cleanly; bind it explicitly in a service provider. This PSR-18 seam is the main reason to adopt the package behind an adapter.
How should I handle failed Mailjet sends and API errors?
The wrapper does not throw exceptions on API failure; post, get, put, and delete return a Response object with success(), getStatus(), getData(), and getReasonPhrase(). Every call site must check success(), or failures become silent. Build an adapter that converts non-2xx responses into typed exceptions and reports them to Laravel's exception handler. For batch sends, HTTP 200 can still contain per-message errors, so parse per-message statuses and dead-letter rejected recipients.
Can I manage contacts, lists, and campaigns, and send SMS with this package?
Yes. The resource helpers cover common Mailjet endpoints such as contacts, lists, and campaigns, and the SMS API supports token-authenticated sends. Email and SMS use different authentication models, so plan for two clients and two credential sets. Send API v3.1 accepts up to 50 messages per call, but a successful HTTP response does not guarantee every message was accepted. Treat audience sync and stats ingestion as separate, larger scope than transactional sending.
How can I test Mailjet API calls without sending real email?
Inject a PSR-18 mock client, such as Http\Mock\Client, and assert on the outgoing request payloads without hitting Mailjet. This works because version 2.0.0 uses PSR-18 and PSR-17 rather than a hard-coded HTTP implementation. The third $CALL boolean can disable API calls, but it is a silent no-op switch and should stay out of production config. Prefer a fake adapter or mock client in tests so failures are explicit.
Is mailjet/mailjet-apiv3-php production-ready and well maintained?
It is an official, MIT-licensed, thin wrapper, so integration and removal costs are low, but community signal is weak at review time (around 274 GitHub stars and no recorded dependents). The package provides no retries, backoff, circuit breaker, rate-limit handling, or idempotency, so those concerns belong to your application. Verify the default branch, tags, release dates, and CI status directly on GitHub because the README still shows a Travis CI badge and has metadata anomalies. Adopt it conditionally behind a first-party interface with typed errors and operational safeguards.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
adachsoft/php-code-style