KD2FW (KD2 is not FrameWork) is a collection of tools and libraries developed for the KD2.org projects over the years.
- Code is simple and straightforward to read
- Simple API
- Easy to extend and adapt to own needs
- No extra dependency, you don't have to install any other library to use it
- Each component can be used outside the framework, there is no internal dependency
- PHP 7.4, compatible up to 8.2 (currently)
- Components comes with full documentation, examples and tests
This framework is used for some websites serving millions of web pages each day.
WARNING: there is currently no release cycle of kd2fw, all components are considered stable, and no backward-incompatible changes should be made (usually).
- Active development branch
- [DB]: abstraction layer to PDO with useful helper methods
- DB/SQLite3: abstraction layer to SQLite3, same API as [DB]
- DB/AbstractEntity: basic data entity, mapped to SQL tables
- DB/EntityManager: retrieve, load, and save entities
- Image: a simple and fast image library providing resize, image informations and image thumbnail through EPEG (JPEG only), ExactImage, GD, ImageMagick or ImLib (will use the fastest available option).
- Blob: to get image size (supports PNG, JPEG and GIF) and EXIF orientation from image blobs, doesn't require any library
- EXIF: deals with EXIF data from JPEG files
- SVG/Bar: bar chart in SVG
- SVG/Pie: renders a pie chart in SVG
- SVG/Plot: renders a plot chart in SVG
- QRCode: generates QR codes
- Smartyer: fast and lightweight template engine, mostly compatible with Smarty / Template_Lite.
- Brindille: lightweight templating engine, similar to Twig/Smarty, but safe
- Mustachier: lightweight template engine based on Mustache (deprecated)
- Mail_Message: parser/writer of email MIME messages (with support for MIME encoded messages and attachments)
- Mail/Mailbox: lightweight IMAP client library using curl
- Mail/Discovery: discover SMTP/IMAP/POP3 servers from an email address, implementing Thunderbird auto-discovery
- SMTP: send emails using SMTP (supports SMTH AUTH and TLS).
- Form: to validate and filter form fields, including CSRF protection
- HTMLDocument: DOMDocument/DOMNode wrapper that adds support for querySelector/querySelectorAll methods (easy to use CSS selectors, internally transformed to XPath queries, so it is quite fast)
- HTML/CSSParser: a lightweight CSS parser and DOM matching engine
- HTML/TableToCSV: transform a HTML table into an CSV file
- HTML/TableToODS: transform HTML tables into an LibreOffice Calc ODS document
- HTML/TableToXLSX: transform HTML tables into an Excel XLSX document
SkrivLite: implementation of the Skriv Markup Language (inspired by Creole and Markdown).
WebDAV/Server: lightweight WebDAV server
WebDAV/WOPI: minimalist WOPI server
WebDAV/NextCloud: NextCloud compatibility layer over WebDAV, so that NextCloud and ownCloud clients may work with a WebDAV server
HTTP: make HTTP requests using curl or PHP file sockets
FeedParser: parses RSS and ATOM feeds, any version, even if they are invalid XML
- Office/Calc/Writer: create ODS (LibreOffice spreadsheets) from raw PHP data
- Office/ToText: convert any OpenDocument file to text
- Delta: to compute and apply deltas between two revisions of the same file (PHP port of Fossil delta algorithm). Allows to store only differences between two edits of a text, may be useful for example in CVS or a Wiki.
- ErrorManager: error and exception handler with dev/prod mode, email reporting and more, like a lightweight version of Nette Tracy
- FossilInstaller: install and upgrade software, using PGP signing, and Fossil-SCM unversioned files API
- JSONSchema: validate JSON documents according to a JSON schema
- Karto: mapping/GPS tools
- UserSession: a basic PHP session manager that can be set to be non-blocking.
- Security: common security functions, including anti CSRF tokens
- Security_OTP: secure one time password generator/verifier, compatible with TOTP/HOTP and Google Authenticator
- SimpleDiff: to compute a text diff between two versions of a string (+patch utility)
- Test: unit testing library
- Translate: platform independent gettext replacement, parses Gettext MO and PO files, optional memory cache
Legacy components (5.6 branch, unmaintained)
|BubbleBabble.php||(Documentation) Encodes and decodes using the Bubble Babble binary data encoding. Much like base64 but makes actually pronounceable pseudo-words.|
|CacheCookie.php||Stores session data in a cookie (using MsgPack if available or JSON as a fallback), without using session files. For MsgPack you can use this pure PHP implementation but the PECL module "msgpack" is much faster.|
|MemCache.php||memory cache wrapper (APCu, XCache, Opcache, etc.)|
|MiniSkel.php||template-based programming language compatible with the SPIP CMS|
|Singleton.php||used to make singleton classes|
|XML_RPC_Server.php||a XML/RPC server using PHP XML/RPC extension|
- Text editor: extends textareas with tools to select, insert or replace content, with support for keyboard shortcuts.
- Code editor: built on Text editor, it provides an easy to use browser code editor including: common keyboard shortcuts, search, search and replace, go to line, fullscreen editing, indentation, brackets/parenthesis matching, line counter, and more.
- Karto (alpha): Mapping/GPS tools (Mercator projection)
- XHR.js: micro XmlHttpRequest library (less than 500 bytes minified)