schneidermanuel/dynalinker

A simple ORM and .ENV Library

Installs: 35

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/schneidermanuel/dynalinker

1.0.16 2023-11-26 14:57 UTC

This package is auto-updated.

Last update: 2025-12-26 20:12:51 UTC


README

This is a minimalistic library for creating simple php applications.

Features

  • Minimalistic ORM
  • Environment Variables
  • Call mapping

Basic usage:

Get the Singleton Dynalinker object and use its functions to generate all the objects. Supports caching.

$dynalinker = Dynalinker::Get();

Minimalistic ORM

Only Supports MySQL and MariaDB

Create an Entity class an annotate it with the Entity attribute, providing the table name as parameter. Annotate every property with persist and provide the column name as attribute. Properties without the persist attribute won't be stored on the database. Put the PrimaryKey Attribute on exactly one attribute to mark it as primary key.

#[Entity("user")]
class TestEntity
{
    #[Persist("userId")]
    #[PrimaryKey]
    public $testProperty;

    #[Persist("userName")]
    public $name;
    #[Persist("pwHash")]
    public $hash;
}

Generate a store object for the entity. Each store object is only responsible for one entity. Basic CRUD-Actions are available on it.

$store = $dynalinker->CreateStore(TestEntity::class);
$entity = new TestEntity();
$entity->name = "Test";
$entity->hash = "FJAF";
$id = $store->SaveOrUpdate($entity);
var_dump($store->LoadById($id));

Environment Variables

Once, Dynalinker::Get(); has been called, all Variables from a .env file lying on the same directory as the composer folder will be available in the $_ENV superglobal.

Call mapping

Will be done soon

License

MIT License.