Releases: eustasy/browning
Releases · eustasy/browning
Browning v1.31
A ground-up rewrite from a single global function into a small, namespaced, dependency-injected library. This is a breaking release : the Browning() / Recaptcha_Verify() functions and the global $Browning config are gone, replaced by classes you construct with your config.
⚠️ Breaking changes
- Requires PHP 8.1+ (was 7.4). Now declares
ext-curl(waslib-curl). - No more global functions or
global $Browning— configuration is injected into classes instead. - PSR-4 autoloading under
Eustasy\Browning\(replaces the files autoloader). - The config file now returns an array instead of populating globals.
- Installs as
composer require eustasy/browning.
Migration
Sending email
// Before (v0.30)
require 'config/browning.php'; // set global $Browning
$mail = Browning('to@example.com', 'Subject', 'Body');
if ($mail['Success']) { /* ... */ }
// After (v1.31)
use Eustasy\Browning\Mailer;
$config = require 'config/browning.php'; // returns an array
$result = Mailer::fromArray($config)->send('to@example.com', 'Subject', 'Body');
if ($result->success) { /* ... */ } else { echo $result->error; }reCAPTCHA
// Before
$v = Recaptcha_Verify($secret, $_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
if ($v['Success']) { /* ... */ }
// After
use Eustasy\Browning\Recaptcha;
$v = Recaptcha::fromArray($config)->verify($_POST['g-recaptcha-response'] ?? null, $_SERVER['REMOTE_ADDR'] ?? null);
if ($v->success) { /* ... */ }✨ What's new
- New Mailer and Recaptcha classes with typed value-object results (
Result,RecaptchaResult)->success,->error,->errorCodes. - A Transport interface + default
CurlTransport: the cURL call is injectable, so it can be swapped (e.g. for tests) without touching the network. Mailer::fromArray()/Recaptcha::fromArray()build straight from the config array.- Friendly-vs-technical error messages via a debug flag (
Mailer::fromArray($config, debug: true)).
🧪 Quality
- New PHPUnit suite (23 tests) : logic unit-tested through a fake transport, plus a real-cURL integration test.
- Fully type-hinted; PHPStan-clean through max.
- The Test (PHP) workflow is enabled (PHP 8.3–8.6, coverage to Qlty).
📝 Docs
- README rewritten for the new API.
- Config ships as
config/browning.default.php: copy it to your own location and fill it in.
Full Changelog: 0.30...1.31
Circle
- Update CI
- Much better README
- Remove demo site
- Simplify error returns
- Better composer support
Square
- Wrap all jQuery to fix broken async loading
- Update License year
- Match new "labs" styles
- Add Badges for Travis CI, Codacy, Code Climate, and Bountysource
- Add NC 1.7
Reed
Archer
Update for Mailgun v3 API
Slim
Trim recaptcha out of release.
Rich
Patch release for common error.
Simple, non-breaking upgrade.
White
Massive code clean-up and re-write. Breaking
Danny-Boy
- Remove Recaptcha Code from Browning_Send Function
- Add Recaptcha_Config File
- Refactor how Recaptcha is Checked
- Update Copyright to 2014
- Add Version Number to Headed Files
Smith
- Removed Unnecessary Recaptcha Files
- Removed Unnecessary Line Breaks
- Added Instructions to Readme
- Added better example function to index
- Added License to Function File
- Added GitHub URL to README, Config, and Function