Changelog — SafeCoder CommonKit for PHP
All notable changes to the library. Versions follow Semantic Versioning.
[1.0.0]
The first release: static helper classes that read, clean, validate and convert values on their way between the request, the application and the database.
It comes as a Composer package — required from its repository, or installed from the release's archive through an artifact repository, no token needed — as an installable Joomla! library (Joomla! 4.3 or newer) and as a WordPress plugin (WordPress 6.1 or newer), the file places the platform's own folders and, on WordPress, the request read with its backslashes stripped.
Nothing throws unless asked — throwIfInvalid: true raises the class's own Ck*Exception with
the reason — and a value that cannot be used comes back as the caller's fallback, an empty value
or a declared placeholder instead. The …OrNull readers answer null, and every class has an
Explain that gives the reason as text.
The classes
CkText— general text: cleaning, names, addresses, HTML to plain text, slugs, masks, and the everyday checks.CkSanitizer— the markup an editor writes, kept safe: formatting, links, images, video and audio stay; script, styles, forms, frames and every other embedding go; and what comes back is written anew, so a browser reads exactly what was kept.CkMedia— the YouTube or Vimeo video a link, a bare code or a pasted embed code names: the code, the canonical addresses, the preview image, and a player written from the code alone, so the application decides where the video goes — each player built one choice at a time: its size and title, autoplay, loop, where it starts, its controls and captions; the YouTube player its stop time and language too, the Vimeo player its color, what it shows over the video and a background mode.Video,ImageandAudioread a file by its address on the web or its path on the site —.mp4,.mov,.webm;.jpg,.png,.gif,.webp,.avif;.mp3,.wav,.ogg,.m4a,.flac— and their elements are the browser's ownvideo,imgandaudio, built the same way: size, title, poster, autoplay, loop, controls, where it starts and stops, what it fetches ahead, lazy loading. The objects live inSafeCoder\CommonKit\Media.CkNumber— numbers read for the database column that will hold them,TinyInttoBigInt,FloatandDecimal, withClamp,RoundandDivide.CkBool— one boolean rule: a real boolean, a word such as yes, no, on or off, or 1 and 0; anything else is unreadable, never false.CkMoney— exact amounts in 160 currencies: reading, formatting, rounding, splitting, allocating, converting and totals, answered as text such as'21.64'.CkDate— dates and moments as Carbon: reading, formatting, time zones, ages and calendar arithmetic — business days, month ends, and the edges of a week, quarter or year.CkEmail— email addresses: reading, comparing, masking, domains and allow-lists.CkUS— US identifiers: phone, SSN, ITIN, EIN, ZIP, state, routing and account numbers, NPI, MBI, DEA, CPT and ICD-10, each with a mask for display.CkCountry— countries by ISO code or name, and their flags.CkIntl— international phone numbers, IBAN, BIC, and postal codes for 181 countries.CkUuid— UUIDs: reading, formatting, name-based ids and time-ordered ids.CkIP— strict IP address reading, CIDR ranges, public and internal checks, and anonymizing for logs.CkFile— safe file names and paths, base64 and data URIs, and file operations inside named places, each with its own rules for extensions and size — on its own, or on Joomla!, Laravel or WordPress.CkWeb— URLs: cleaning, comparing, domain allow-lists, query parameters, and a check before sending anything to a stored address.CkGeo— coordinates in decimal, degrees-minutes-seconds, WKT and GeoJSON; distances, bearings and "within a radius" searches.CkSentinel— turns placeholder values — empty text, zeros, placeholder dates, the nil UUID — into real nulls before saving.CkPayload— JSON, form, query-string and CSV text into a plain array, reading the request itself when no text is passed.CkRequest— the current request, read once:String,Bool,Html,MapandMaps,Number,DateandUuidwith the kind chosen at the end of the call, andBag()for the body, the query string, the headers, the cookies, the method and the client address.CkDictionary— typed values out of any array — a payload,$_POST, a database row — with dotted paths such as"customer.address.zip".
CkSettings holds every limit and default in one place, your time zone and where your files
live included.
Requirements
PHP 8.2 or later, with the dom, intl and mbstring extensions. Nothing else to install: the
packages the library builds on — brick/math, brick/money, Carbon, ramsey/uuid and masterminds/html5
— come bundled under its own namespace, so they never clash with the versions your application uses.