glueful/framework 问题修复 & 功能扩展

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

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

glueful/framework

Composer 安装命令:

composer require glueful/framework

包简介

Glueful API Framework - High-performance PHP API framework

README 文档

README

High‑performance PHP API framework components for building secure, scalable backends. This repository contains the framework runtime (router, DI, HTTP, caching, security, queues, etc.). For a ready‑to‑use application skeleton, see the API skeleton link below.

Requirements

  • PHP 8.3+
  • Composer 2+

Installation

Install as a library into your application:

composer require glueful/framework

If you want a pre‑scaffolded app, use the API skeleton instead (recommended to get started quickly).

Quick Start (framework usage)

Bootstrap and handle a request:

<?php
declare(strict_types=1);

use Glueful\Framework;
use Symfony\Component\HttpFoundation\Request;

require __DIR__ . '/vendor/autoload.php';

$framework = Framework::create(__DIR__)
    ->withConfigDir(__DIR__ . '/config')
    ->withEnvironment($_ENV['APP_ENV'] ?? 'development');

$app = $framework->boot();

// Define a quick route (see cookbook for best practices)
$router = $app->getContainer()->get(Glueful\Routing\Router::class);
$router->get('/ping', fn() => new Glueful\Http\Response(['ok' => true]));

$request = Request::createFromGlobals();
$response = $app->handle($request);
$response->send();
$app->terminate($request, $response);

Getting Started

Documentation

  • Official docs website: https://glueful.com (mirror: https://glueful.dev)
  • Logging bootstrap guide: docs/LOGGING_BOOTSTRAP.md
  • Changelog: CHANGELOG.md
  • Roadmap: ROADMAP.md
  • Breaking changes process: BREAKING_CHANGE_PROCESS.md

Highlights

  • High-Performance Router: O(1) static route lookup, dynamic route bucketing, attribute-based routing, middleware pipeline
  • Dependency Injection: Symfony Container with service providers, lazy services, ApplicationContext injection
  • Authentication: JWT, LDAP, SAML SSO, API keys with session analytics; opt-in email-PIN 2FA
  • Encryption: AES-256-GCM authenticated encryption with key rotation support
  • File Uploads: Blob storage with visibility controls, signed URLs, thumbnail generation, media metadata
  • Caching: Multi-driver support (Redis/Memcached/File) with distributed caching; tag-based invalidation on the Redis driver
  • Queue System: Job processing with Redis/Database backends, auto-scaling workers
  • Security: Enhanced rate limiting, CSRF protection, security headers, lockdown mode
  • Database: Query builder, migrations, connection pooling (MySQL, PostgreSQL, SQLite)
  • Extensions: Modular extension system with lifecycle management
  • CLI Tools: Comprehensive scaffold commands, migrations, cache management

Email Two-Factor Authentication (2FA)

Baseline email-PIN 2FA ships in core and is off by default — a fresh install behaves exactly like a pre-2FA framework. To enable it (no source-code editing required):

  1. Run the 010_AddTwoFactorEnabledToUsers migration (ships in api-skeleton).
  2. Install glueful/email-notification (provides the email channel + two-factor-pin template).
  3. Set TWO_FACTOR_ENABLED=true in .env.
  4. Enroll users via POST /2fa/enable or php glueful 2fa:enable <user-uuid>.

Once enabled, POST /auth/login returns a challenge_token (and emails a 6-digit PIN) for enrolled users instead of tokens; the client completes login at POST /2fa/verify. Richer factors (TOTP, WebAuthn, recovery codes) ship separately as glueful/mfa.

Generating an SDK client

Glueful produces a high-quality openapi.json; client generation is delegated to best-of-breed tools per language. The generate:client command builds the right shell invocation for you:

# Produce the spec
php glueful generate:openapi

# TypeScript types via openapi-typescript
php glueful generate:client typescript --output=./sdk

# Other languages via openapi-generator-cli
php glueful generate:client python --output=./python-client
php glueful generate:client go --output=./go-client

By default the command prints the shell command so you can pin a specific generator version in CI. Add --execute to run the generator directly. See docs/WEBHOOKS.md for how to surface outbound webhooks in the spec for SDK consumers.

Deployment Notes

  • For long-running servers (RoadRunner, Swoole, FrankenPHP), set APP_LONG_RUNNING=true to enable worker-safe lifecycle handling.
  • If your deploy process preserves file mtimes and you see stale routing, clear the route cache as part of deploy:
    • php glueful route:cache:clear

API Skeleton (recommended to start)

For a ready‑to‑run project scaffold, use the API skeleton and follow its README. It wires this framework, public entrypoints, config, and examples:

Quick start:

composer create-project glueful/api-skeleton my-app
cd my-app
php glueful serve

Contributing

Contributions are welcome. Please open issues or PRs. For larger proposals, consider starting with a discussion referencing the implementation plans in docs/implementation_plans/.

License

MIT — see LICENSE.

glueful/framework 适用场景与选型建议

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

它主要适用于以下技术方向: 「framework」 「database」 「queue」 「php」 「rest」 「api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-09-13