celeris/api 问题修复 & 功能扩展

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

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

celeris/api

Composer 安装命令:

composer create-project celeris/api

包简介

Celeris API base application scaffold for building service-oriented and REST APIs.

README 文档

README

celeris/api is a base application scaffold for building REST APIs and service-oriented backends on top of celeris/framework.

It gives you a practical starting point instead of an empty shell: a bootstrapped HTTP entrypoint, API controllers, DTOs, services, repositories, config files, migrations, seeded example data, and optional notification worker hooks.

What It Is For

Use this package when you want to start a new API quickly without rebuilding the same foundation each time.

It is a good fit for:

  • internal business APIs
  • service-oriented backends
  • CRUD-heavy applications
  • authenticated JSON APIs
  • projects that may later grow into event-driven or notification-enabled services

Included Features

  • API-first bootstrap with a JSON root endpoint and /health style service readiness flow
  • Example auth endpoints under /api/auth for login and identity inspection
  • Example resource endpoints under /api/contacts
  • Attribute-based routing through Celeris controllers
  • DTO-driven request input mapping for create and update flows
  • Service and repository layers already separated for easier maintenance
  • Autodiscovered model lifecycle listeners for onCreate, onUpdate, onDelete, and onShow
  • Database configuration, migrations, and seed data out of the box
  • Environment-based security toggles for JWT, opaque tokens, cookie sessions, API tokens, and mTLS
  • Built-in rate-limit configuration
  • Optional notification integrations for SMTP, in-app notifications, transactional outbox, realtime delivery, and dispatch workers
  • CLI wrappers for migrations and worker scripts

Advantages

  • Faster project setup: you can begin with working application structure immediately
  • Clear boundaries: controllers, services, repositories, DTOs, config, and bootstrap are already organized
  • Safer customization: generated base classes and extension points make it easier to evolve scaffolded code cleanly
  • Production-friendly direction: auth, rate limiting, migrations, and notification workflows are already anticipated
  • Monorepo-friendly local development: the stub can run against the local framework package during development

Default API Surface

The scaffold currently exposes these starter endpoints:

  • GET / returns basic API and framework metadata
  • POST /api/auth/login authenticates the demo user and returns a token payload
  • GET /api/auth/me returns the authenticated identity
  • GET /api/contacts lists contacts
  • GET /api/contacts/{id} fetches one contact
  • POST /api/contacts creates a contact
  • PUT /api/contacts/{id} updates a contact
  • DELETE /api/contacts/{id} deletes a contact

Model lifecycle listeners live under app/Listeners/Models and are registered automatically by AppServiceProvider.

Treat these as a starting point. They are intentionally simple so you can replace, extend, or remove them as your real domain takes shape.

Quick Start

Create a project from the package:

composer create-project celeris/api my-api
cd my-api
cp .env.example .env
composer install
php celeris app-key
php bin/migrate.php up
php -S 127.0.0.1:8000 -t public

If you are working inside the Celeris monorepo, the scaffold can also fall back to the local framework bootstrap and CLI binary during development.

Project Structure

  • public/index.php boots the HTTP kernel and loads route files
  • routes/api.php registers API controllers and direct API routes
  • app/Http/Controllers/v1 contains your versioned API controllers
  • app/Http/DTOs contains request DTOs
  • app/Services holds application use cases
  • app/Repositories contains persistence-facing code
  • database/migrations contains schema changes
  • database/seeds contains sample seed data
  • config centralizes environment-driven app behavior
  • bin contains migration and notification worker helpers

Notifications and Background Work

The stub is ready for optional notification packages, but keeps them disabled by default. That means you can start lean and only enable the pieces you actually need.

When those packages are installed, the scaffold already includes entrypoints such as:

  • php bin/notifications-dispatch-worker.php
  • php bin/notifications-replay-dead-letter.php

This makes the package a nice fit for APIs that may grow from simple synchronous CRUD into more resilient event-driven workflows.

Recommendations

  • Replace the sample Contact domain early with your real bounded context
  • Copy .env.example to .env and explicitly review all security flags before deploying
  • Set APP_KEY and JWT_SECRET before enabling JWT authentication
  • Keep auth strategies opt-in; only enable the ones your service truly needs
  • Treat the demo credentials as development-only scaffolding
  • Add your domain-specific tests as soon as you start replacing the example endpoints
  • If you adopt the outbox flow, run the dispatch worker separately from the HTTP process

Tip

The best way to use this stub is not to preserve every sample file, but to preserve the structure. Replace the demo domain quickly, keep the layering, and let the scaffold accelerate your first real feature instead of becoming long-lived placeholder code.

celeris/api 适用场景与选型建议

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

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

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-24