schneidermanuel/dynalinker 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

schneidermanuel/dynalinker

最新稳定版本:1.0.16

Composer 安装命令:

composer require schneidermanuel/dynalinker

包简介

A simple ORM and .ENV Library

README 文档

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.

统计信息

  • 总下载量: 34
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-10-17