PHPackages                             kenai/ks - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kenai/ks

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

kenai/ks
========

A lightweight PHP library

561[1 issues](https://github.com/Omar-Gonzalez/KS-PHP/issues)PHP

Since Apr 24Pushed 8y ago2 watchersCompare

[ Source](https://github.com/Omar-Gonzalez/KS-PHP)[ Packagist](https://packagist.org/packages/kenai/ks)[ RSS](/packages/kenai-ks/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (0)

KS PHP
======

[](#ks-php)

What is this?
-------------

[](#what-is-this)

#### A small PHP library for CRUD like apps

[](#a-small-php-library-for-crud-like-apps)

- The main design criteria for this library was to make my life easier as a freelance web dev
- It uses an Active record class that creates a table with given model
- The model has convenience methods to interact with the DB records
- HTML Output class that will build Components and Forms based on models

Prerequisites
-------------

[](#prerequisites)

- PHP7
- Strict types enabled
- MySQL or Maria DB

Plays nice with
---------------

[](#plays-nice-with)

- Any shared host with PHP7
- Twitter Bootstrap
- Need REST end points? [Slim](https://www.slimframework.com/) is pretty great

Config
------

[](#config)

- Fill Config.php

```
      const DEBUG_MODE = true;
      const TIME_ZONE = "America/Mexico_City";
      const HOST = "host=127.0.0.1:8889";
      const DB = "KS";
      const DB_USER = "root";
      const DB_PW = "1111";
```

Classes
-------

[](#classes)

#### KS\\DB - Convinience methods for DB interaction

[](#ksdb---convinience-methods-for-db-interaction)

- Execute a SQL statement, returns a PDOStatement

```
    DB::sql("SELECT * FROM `cats`")->fetchAll();
```

- Returns a new instance of PDO with Config.php params

```
    $pdo = DB::pdo();
```

#### KS\\MODEL - Active Record Classes for BD Interaction

[](#ksmodel---active-record-classes-for-bd-interaction)

1-Extend a new custom model from KS\\Model

2-Assign public properties with type:

```
    class Cat extends KS\Model\Model
    {
        public $name = "string"; //string
        public $age = 1; //integer
        public $is_fat = true; //boolean
    }
```

3 - KS\\Model will automatically create a table

4 - Use chained methods to manipulate the db

```
     //Save new Model
     $c = new Cat();
     $c->name = "Odin";
     $c->age = 6;
     $c->is_fat = true;
     $c->save();

     //Or save new record with a $_POST array
     $c->save($_POST);

     //Find row with id
     Cat::find(1)->get();

     //Return type json/object
     Cat::find(1)->json();
     Cat::find(1)->object();

     //Update with id
     $c = new Cat();
     $c->name = "Odin";
     $c->age = 7;
     $c->is_fat = false;
     $c->update(1);

     //Delete with id
     Cat::delete(1);
```

#### KS\\HMTL - for HTML output

[](#kshmtl---for-html-output)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/87a8ed79ce002470f6c3e262744e63d9cf9b704dbe4b9e3af9e9a40538a1df7e?d=identicon)[Omar Gonzalez Rocha](/maintainers/Omar%20Gonzalez%20Rocha)

---

Top Contributors

[![Omar-Gonzalez](https://avatars.githubusercontent.com/u/5205340?v=4)](https://github.com/Omar-Gonzalez "Omar-Gonzalez (28 commits)")

### Embed Badge

![Health badge](/badges/kenai-ks/health.svg)

```
[![Health](https://phpackages.com/badges/kenai-ks/health.svg)](https://phpackages.com/packages/kenai-ks)
```

###  Alternatives

[tedivm/jshrink

Javascript Minifier built in PHP

76137.7M138](/packages/tedivm-jshrink)[phpseclib/mcrypt_compat

PHP 5.x-8.x polyfill for mcrypt extension

28029.7M34](/packages/phpseclib-mcrypt-compat)[phpbench/container

Simple, configurable, service container.

1512.9M6](/packages/phpbench-container)[georgringer/numbered-pagination

Improved pagination for TYPO3

281.3M13](/packages/georgringer-numbered-pagination)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
