Skip to content

Releases: eustasy/browning

Browning v1.31

31 May 15:38
d6cc9a0

Choose a tag to compare

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 (was lib-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

20 Apr 20:19
d445976

Choose a tag to compare

  • Update CI
  • Much better README
  • Remove demo site
  • Simplify error returns
  • Better composer support

Square

15 Oct 21:36

Choose a tag to compare

  • 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

26 Sep 18:50

Choose a tag to compare

  • #5 Update code example and add to the homepage.
  • #3 Move to a puff format.
  • #2 Upgrade and conditionally load ReCaptcha.
  • #1 Redesign homepage to be in line with new labs branding.

Archer

24 Mar 22:55

Choose a tag to compare

Update for Mailgun v3 API

Slim

29 Jan 14:21

Choose a tag to compare

Trim recaptcha out of release.

Rich

21 Dec 22:01

Choose a tag to compare

Patch release for common error.
Simple, non-breaking upgrade.

White

03 Dec 16:05

Choose a tag to compare

Massive code clean-up and re-write. Breaking

Danny-Boy

06 Jan 11:09

Choose a tag to compare

  • 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

08 Dec 16:00

Choose a tag to compare

  • 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