PHPackages                             kksonthomas/kkson-framework - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. kksonthomas/kkson-framework

ActiveLibrary[Framework](/categories/framework)

kksonthomas/kkson-framework
===========================

self use framework

v0.11.0.0(2w ago)0166MITPHPPHP &gt;=8.1.0

Since Feb 26Pushed 2w ago1 watchersCompare

[ Source](https://github.com/kksonthomas/kkson-framework)[ Packagist](https://packagist.org/packages/kksonthomas/kkson-framework)[ RSS](/packages/kksonthomas-kkson-framework/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (120)Versions (69)Used By (0)

KKson Framework
===============

[](#kkson-framework)

PHP admin/CRUD framework built on Slim 2, RedBeanPHP, Plates, and AdminLTE. Includes authentication, CRUD UI, search/export, permissions, and system logging.

Installation
------------

[](#installation)

```
composer require kksonthomas/kkson-framework
```

Add configuration under your application `conf/` directory:

- `app.config.ini` — environment and app settings (`env` selects the DB config file)
- `db.config.{env}.ini` — database connection

Database transactions and Writer Cache (v0.11.0.0+)
---------------------------------------------------

[](#database-transactions-and-writer-cache-v01100)

Updating to v0.11.0.0+ enables transactional CRUD by default and adds `DB::begin()`, `DB::commit()`, `DB::rollback()`, and `DB::transaction()` with Writer Cache flush on rollback.

```
composer require kksonthomas/kkson-framework:^0.11.0.0
```

CRUD insert, update, and delete run inside a DB transaction **by default**. Opt out on a CRUD instance:

```
$crud->setIsInsertUpdateUseTransaction(false);
```

Transactions require frozen RedBean (`DB::fixSchema()` / `R::freeze(true)` in normal app bootstrap).

### `DB` transaction API

[](#db-transaction-api)

Use `KKsonFramework\App\DB` for transaction control instead of importing `R` for `begin` / `commit` / `rollback`:

```
use KKsonFramework\App\DB;

DB::begin();
try {
    // ...
    DB::commit();
} catch (\Throwable $e) {
    DB::rollback(); // rolls back + flushes RedBean Writer Cache
    throw $e;
}

// or
DB::transaction(function () {
    // ...
});
```

### Why rollback flushes cache

[](#why-rollback-flushes-cache)

RedBean 5.7 Writer Cache (default ON) caches `R::find`, `R::findOne`, `R::load`, and related read queries. `R::store` and `R::exec` invalidate the cache on the next cached read; **`R::rollback()` does not**. After a rollback, cached reads can still return rows from the undone transaction.

`DB::rollback()` and a failed `DB::transaction()` call `R::getWriter()->flushCache()` as [RedBean recommends](https://www.redbeanphp.com/index.php?p=/database). Successful commits do not flush cache (committed data matches the cache). Direct SQL via `R::getCell` / `R::getAll` is not Writer-cached.

Custom code that still uses `R::begin()` / `R::rollback()` directly should switch to `DB::*` or call `R::getWriter()->flushCache()` after rollback.

IP ban performance (v0.10.4.1+)
-------------------------------

[](#ip-ban-performance-v01041)

Updating the package improves IP ban behavior without any database change. Unauthenticated requests only check existing bans; failed-login counting runs after a failed login.

For faster queries on large `system_log` tables, apply the optional SQL patch once:

```
vendor/kksonthomas/kkson-framework/sql/patch-v0.10.4.1-ip-ban.sql

```

Example:

```
mysql -u USER -p DATABASE
