dlunire/dlcore 问题修复 & 功能扩展

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

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

dlunire/dlcore

Composer 安装命令:

composer require dlunire/dlcore

包简介

DLCore es el núcleo funcional del framework DLUnire. Proporciona el ORM, motor de plantillas, autenticación, envío de correos y lectura avanzada de variables de entorno con tipado estático. Todo lo esencial para construir aplicaciones modernas en PHP con una arquitectura limpia y extensible

README 文档

README

Español

Dependencia de Infraestructura

DLCore requiere DLRoute como proveedor del contexto de ejecución. Esto incluye, pero no se limita a:

  • Resolución del document root
  • Contexto del entorno de servidor
  • Resolución base del sistema de archivos y rutas

DLCore no inicializa ni define el entorno de ejecución. Su responsabilidad es consumir dicho entorno de forma determinista, delegando esta tarea a DLRoute como capa de infraestructura.

Esta dependencia es intencional y estructural, y forma parte del diseño arquitectónico del framework. DLRoute actúa como la capa inferior que abstrae el entorno de ejecución, mientras que DLCore construye sobre dicho contexto sin duplicar responsabilidades.

English

Infrastructure Dependency

DLCore requires DLRoute as the execution context provider. This includes, but is not limited to:

  • Document root resolution
  • Server environment context
  • Base filesystem and path resolution

DLCore does not initialize nor define the execution environment. Its responsibility is to consume that environment deterministically, delegating this role to DLRoute as the infrastructure layer.

This dependency is intentional and structural, and is part of the framework’s architectural design. DLRoute acts as the lower-level layer that abstracts the execution environment, while DLCore builds on top of that context without duplicating responsibilities.

Installation

To install dlunire/dlcore, run the following command:

composer require dlunire/dlcore

Important: You must have Composer installed before installing this tool. If you don’t have it yet, visit Composer’s official website and follow the instructions.

Instalación

Para instalar dlunire/dlcore, ejecute el siguiente comando:

composer require dlunire/dlcore

Importante: debe tener instalado Composer previamente. Si no lo tiene, visite el sitio oficial de Composer y siga las instrucciones.

Features / Características

  • Query builder.
  • Model system.
  • Typed environment variable reader, which validates types such as string, integer, boolean, email, and uuidv4, even without a traditional .env file.
  • Template parser for *.template.html files with syntax similar to Laravel Blade.

Template Syntax Comparison / Comparación con Laravel

Feature Laravel DLCore
Base template @extends('base') @base('base')
Template directory /resources/ /resources/
Template extension .blade.php .template.html
JSON output @json($array) @json($array, 'pretty')
Markdown support N/A @markdown('file')
Looping @for(...) @endfor @for(...) @endfor

Markdown files must be placed in /resources/ and use .md extensions, but do not include the extension in @markdown().

Usage / Uso

Environment Variables / Variables de entorno

Create a .env.type file with typed variables:

DL_PRODUCTION: boolean = false
DL_DATABASE_HOST: string = "localhost"
DL_DATABASE_PORT: integer = 3306
DL_DATABASE_USER: string = "your-user"
DL_DATABASE_PASSWORD: string = "your-password"
DL_DATABASE_NAME: string = "your-database"
DL_DATABASE_CHARSET: string = "utf8"
DL_DATABASE_COLLATION: string = "utf8_general_ci"
DL_DATABASE_DRIVE: string = "mysql"
DL_PREFIX: string = "dl_"

To send emails:

MAIL_USERNAME: email = no-reply@example.com
MAIL_PASSWORD: string = "password"
MAIL_PORT: integer = 465
MAIL_COMPANY_NAME: string = "Your Company"
MAIL_CONTACT: email = contact@example.com

Google reCAPTCHA keys:

G_SECRET_KEY: string = "<secret-key>"
G_SITE_KEY: string = "<site-key>"

For syntax highlighting, install DL Typed Environment extension

Models / Modelos

<?php
namespace App\Models;

use DLCore\Database\Model;

class Products extends Model {}

To change the table name:

class Products extends Model {
    protected static ?string $table = "custom_table";
}

Subqueries are supported:

class Products extends Model {
    protected static ?string $table = "SELECT * FROM products WHERE active = 1";
}

Controller interaction / Interacción desde un controlador

<?php
use DLCore\Core\BaseController;

final class TestController extends BaseController {
  public function products(): array {
    $register = Products::get();
    $count = Products::count();
    $page = 1;
    $paginate = Products::paginate($page, 50);

    return [
      "count" => $count,
      "register" => $register,
      "paginate" => $paginate
    ];
  }
}

Creating records / Creación de registros

<?php
final class TestController extends BaseController {
  public function create_product(): array {
    $created = Products::create([
      "product_name" => $this->get_required('product-name'),
      "product_description" => $this->get_input('product-description')
    ]);

    http_response_code(201);
    return [
      "status" => $created,
      "success" => "Product created successfully."
    ];
  }
}

Sending emails / Envío de correos

<?php
use DLCore\Core\BaseController;
use DLCore\Mail\SendMail;

final class TestController extends BaseController {
  public function mail(): array {
    $email = new SendMail();
    return $email->send(
      $this->get_email('email_field'),
      $this->get_required('body_field')
    );
  }
}

Authentication system / Sistema de autenticación

<?php
use DLCore\Auth\DLAuth;
use DLCore\Auth\DLUser;

class Users extends DLUser {
  public function capture_credentials(): void {
    $auth = DLAuth::get_instance();

    $this->set_username(
      $this->get_required('username')
    );

    $this->set_password(
      $this->get_required('password')
    );

    $auth->auth($this, [
      "username_field" => 'username',
      "password_field" => 'password',
      "token_field" => 'token'
    ]);
  }
}

Documentation / Documentación

Usage tutorial / Tutorial de uso

Progressive guide (Spanish): docs/tutorial/README.md

# Topic / Tema
1 Quick start / Inicio rápido
2 Typed env vars / Variables de entorno
3 Models & queries / Modelos ORM
4 Controllers / Controladores
5 Templates / Plantillas
6 Authentication / Autenticación
7 Email / Correo
8 Markdown, JSON & views / Markdown, JSON y vistas
9 SQL queries / Consultas SQL
10 Bootstrap & ops / Bootstrap y operación
11 Exceptions & tests / Excepciones y pruebas
12 File uploads / Subida de archivos
13 Encrypted credentials / Credenciales cifradas
14 View cache / Caché de vistas
15 Time / Tiempo (DLTime)
16 Advanced logs / Logs avanzados
17 Advanced Path / Path avanzado
18 PDF (view_pdf)
19 URL validation (BaseURL)
20 Credentials & Environment
21 Skeleton helpers & advanced ORM / Helpers del skeleton y ORM avanzado
22 Production deployment / Despliegue en producción
23 DL_TOKEN, CORS & ORM APIs / CORS, DL_TOKEN y ORM en APIs
24 ORM aggregations / Agregaciones y ORM avanzado
25 Advanced writes & transactions / Escritura avanzada y transacciones
26 Advanced DLRoute / Rutas avanzadas de DLRoute
27 DLAuth & route protection / DLAuth y protección de rutas

Module reference: docs/ (DLConfig, DLDatabase, DLRequest, template syntax).

Infrastructure layer: DLRoute — routing, HTTP requests, file uploads / SVG sanitization.

Capa de infraestructura: DLRoute — enrutamiento, peticiones HTTP, subida de archivos / saneamiento SVG.

Esta documentación se actualizará progresivamente. DLCore posee muchas funcionalidades avanzadas que requieren tiempo para documentarse con precisión.

dlunire/dlcore 适用场景与选型建议

dlunire/dlcore 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 268 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 dlunire/dlcore 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 dlunire/dlcore 我们能提供哪些服务?
定制开发 / 二次开发

基于 dlunire/dlcore 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: AGPL-3.0-or-later
  • 更新时间: 2025-04-08