├── config └── brevo.php ├── src ├── BrevoServiceProvider.php ├── Brevo.php └── Facades │ └── Brevo.php ├── LICENSE.md ├── CHANGELOG.md ├── composer.json └── README.md /config/brevo.php: -------------------------------------------------------------------------------- 1 | env('BREVO_API_KEY', null), 20 | 21 | 'partner_key' => env('BREVO_PARTNER_KEY', null), 22 | 23 | ]; 24 | -------------------------------------------------------------------------------- /src/BrevoServiceProvider.php: -------------------------------------------------------------------------------- 1 | app->runningInConsole()) { 18 | $this->publishes([ 19 | __DIR__.'/../config/brevo.php' => config_path('brevo.php'), 20 | ], 'brevo.config'); 21 | } 22 | } 23 | 24 | public function register(): void 25 | { 26 | // Automatically apply the package configuration. 27 | $this->mergeConfigFrom(__DIR__.'/../config/brevo.php', 'brevo'); 28 | 29 | // Bind the service to the container. 30 | $this->app->singleton('brevo', fn () => new Brevo); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Sven Hofmann 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/Brevo.php: -------------------------------------------------------------------------------- 1 | configuration = Configuration::getDefaultConfiguration()->setApiKey('api-key', config('brevo.api_key')); 16 | 17 | if (config('brevo.partner_key')) { 18 | $this->configuration->setApiKey('partner-key', config('brevo.partner_key')); 19 | } 20 | } 21 | 22 | public function __call(string $name, array $arguments) 23 | { 24 | $class = "Brevo\\Client\Api\\{$name}"; 25 | 26 | return ! isset($arguments[0]) ? new $class( 27 | null, 28 | $this->getConfiguration() 29 | ) : new $class($arguments[0], $this->getConfiguration()); 30 | } 31 | 32 | public function getConfiguration(): Configuration 33 | { 34 | return $this->configuration; 35 | } 36 | 37 | public function setConfiguration(Configuration $configuration): void 38 | { 39 | $this->configuration = $configuration; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | Notable changes and release notes of the _Laravel Brevo_ package. 4 | 5 | ## 2.1.2 / Release - 2025-11-26 6 | - Apply Symfony security release following [CVE-2025-64500](https://github.com/advisories/GHSA-3rg7-wf37-54rm) 7 | 8 | ## 2.1.1 / Release - 2025-05-23 9 | - Apply Commonmark security release following [CVE-2025-46734](https://github.com/advisories/GHSA-3527-qv2q-pfvx) 10 | 11 | ## 2.1.0 / Release - 2025-04-04 12 | - Add support for Laravel 12 13 | 14 | ## 2.0.0 / Release - 2025-02-03 15 | - Add support for `getbrevo/brevo-php` v2 16 | - Improve usage via the Facade - Thanks to @tiran133 for the contribution! 17 | - Add tests for PHP 8.4 18 | 19 | ## 1.2.4 / Release - 2025-01-20 20 | - Apply Carbon security release following [CVE-2025-22145](https://github.com/advisories/GHSA-j3f9-p6hm-5w6q) 21 | 22 | ## 1.2.3 / Release - 2024-12-17 23 | - Apply Commonmark security release following [GHSA-c2pc-g5qf-rfrf](https://github.com/thephpleague/commonmark/security/advisories/GHSA-c2pc-g5qf-rfrf) 24 | 25 | ## 1.2.2 / Release - 2024-11-13 26 | - Apply Laravel security release following [CVE-2024-52301](https://github.com/advisories/GHSA-gv7v-rgg6-548h) 27 | 28 | ## 1.2.1 / Release - 2024-11-08 29 | - Apply Symfony security release following [CVE-2024-51736](https://github.com/advisories/GHSA-qq5c-677p-737q) 30 | 31 | ## 1.2.0 / Release - 2024-03-14 32 | - Add support for Laravel 11 33 | 34 | ## 1.1.0 / Release - 2024-03-05 35 | - Convert protected variables to private. 36 | - Enforce custom formatting with Laravel Pint (GitHub Action). 37 | - Add tests for PHP 8.3 38 | 39 | ## 1.0.0 / Release - 2024-02-05 40 | - Official release of the package. 41 | 42 | ## 0.1.1 / Beta Release - 2023-11-13 43 | - Add strict types directive to the configuration file. 44 | - Add Laravel Pint PHP code style fixer as a development dependency. Usage: `composer format` 45 | 46 | ## 0.1.0 / Beta Release - 2023-11-05 47 | - Full working version of the package. 48 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hofmannsven/laravel-brevo", 3 | "description": "Laravel wrapper for Brevo's API v3 PHP library.", 4 | "keywords": [ 5 | "laravel", 6 | "brevo" 7 | ], 8 | "homepage": "https://github.com/hofmannsven/laravel-brevo", 9 | "license": "MIT", 10 | "type": "library", 11 | "authors": [ 12 | { 13 | "name": "Sven Hofmann", 14 | "email": "info@hofmannsven.com", 15 | "homepage": "https://hofmannsven.com", 16 | "role": "Developer" 17 | } 18 | ], 19 | "support": { 20 | "email": "info@hofmannsven.com", 21 | "issues": "https://github.com/hofmannsven/laravel-brevo/issues", 22 | "source": "https://github.com/hofmannsven/laravel-brevo", 23 | "wiki": "https://github.com/hofmannsven/laravel-brevo/wiki" 24 | }, 25 | "require": { 26 | "php": "^8.1", 27 | "getbrevo/brevo-php": "^1.0|^2.0", 28 | "illuminate/contracts": "^8.0|^9.0|^10.0|^11.0|^12.0" 29 | }, 30 | "require-dev": { 31 | "laravel/pint": "^1.14", 32 | "nunomaduro/collision": "^7.0|^8.0", 33 | "orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0", 34 | "phpunit/phpunit": "^10.1|^11.0" 35 | }, 36 | "autoload": { 37 | "psr-4": { 38 | "Hofmannsven\\Brevo\\": "src/" 39 | } 40 | }, 41 | "autoload-dev": { 42 | "psr-4": { 43 | "Hofmannsven\\Brevo\\Tests\\": "tests/" 44 | } 45 | }, 46 | "scripts": { 47 | "test": "vendor/bin/testbench package:test --no-coverage", 48 | "test-coverage": "vendor/bin/phpunit --coverage-html coverage", 49 | "format": "vendor/bin/pint" 50 | }, 51 | "config": { 52 | "sort-packages": true 53 | }, 54 | "extra": { 55 | "laravel": { 56 | "providers": [ 57 | "Hofmannsven\\Brevo\\BrevoServiceProvider" 58 | ], 59 | "aliases": { 60 | "Brevo": "Hofmannsven\\Brevo\\Facades\\Brevo" 61 | } 62 | } 63 | }, 64 | "minimum-stability": "dev", 65 | "prefer-stable": true 66 | } 67 | -------------------------------------------------------------------------------- /src/Facades/Brevo.php: -------------------------------------------------------------------------------- 1 | getAccount(); 44 | var_dump($result); 45 | 46 | // Domains 47 | $result = Brevo::DomainsApi()->getDomains(); 48 | var_dump($result); 49 | 50 | // Contacts 51 | $result = Brevo::ContactsApi()->getContacts(); 52 | var_dump($result); 53 | 54 | // With custom client 55 | $result = Brevo::AccountApi( 56 | new \GuzzleHttp\Client() 57 | )->getAccount(); 58 | ``` 59 | 60 | ## Available APIs 61 | 62 | Use any `getbrevo/brevo-php` API (see [supported functions](https://developers.brevo.com/docs/available-functions-in-api-clients)): 63 | 64 | - AccountApi 65 | - AttributesApi 66 | - CompaniesApi 67 | - ContactsApi 68 | - ConversationsApi 69 | - CouponsApi 70 | - CRMApi 71 | - DealsApi 72 | - DomainsApi 73 | - EcommerceApi 74 | - EmailCampaignsApi 75 | - EventsApi 76 | - ExternalFeedsApi 77 | - FilesApi 78 | - FoldersApi 79 | - InboundParsingApi 80 | - ListsApi 81 | - MasterAccountApi 82 | - NotesApi 83 | - ProcessApi 84 | - ResellerApi 85 | - SendersApi 86 | - SMSCampaignsApi 87 | - TasksApi 88 | - TransactionalEmailsApi 89 | - TransactionalSMSApi 90 | - TransactionalWhatsAppApi 91 | - UserApi 92 | - WebhooksApi 93 | - WhatsAppCampaignsApi 94 | 95 | ## Development 96 | 97 | ### Code Style Fixer 98 | 99 | ```bash 100 | composer format 101 | ``` 102 | 103 | ### Testing 104 | 105 | ```bash 106 | composer test 107 | ``` 108 | 109 | ## Changelog 110 | 111 | Please read the [changelog](https://github.com/hofmannsven/laravel-brevo/blob/master/CHANGELOG.md) for more information about recent changes. 112 | 113 | ## Contributing 114 | 115 | Please read the [contribution guidelines](https://github.com/hofmannsven/laravel-brevo/blob/master/.github/CONTRIBUTING.md) for details. 116 | 117 | ## Support 118 | 119 | Always feel free to [raise an issue](https://github.com/hofmannsven/laravel-brevo/issues) on GitHub. 120 | 121 | ## Security 122 | 123 | If you discover a security issue, please contact me directly. 124 | My GPG fingerprint/key is available on [Keybase](https://keybase.io/hofmannsven). 125 | 126 | ## Credits 127 | 128 | - [Sven Hofmann](https://github.com/hofmannsven) 129 | - [All Contributors](https://github.com/hofmannsven/laravel-brevo/graphs/contributors) 130 | 131 | ## License 132 | 133 | MIT License (MIT). Please read the [license](LICENSE.md) for more information. 134 | 135 | Laravel and the Laravel logo are trademarks of Taylor Otwell. Banner image generated with banners.beyondco.de 136 | --------------------------------------------------------------------------------