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
/healthstyle service readiness flow - Example auth endpoints under
/api/authfor 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, andonShow - 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 metadataPOST /api/auth/loginauthenticates the demo user and returns a token payloadGET /api/auth/mereturns the authenticated identityGET /api/contactslists contactsGET /api/contacts/{id}fetches one contactPOST /api/contactscreates a contactPUT /api/contacts/{id}updates a contactDELETE /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.phpboots the HTTP kernel and loads route filesroutes/api.phpregisters API controllers and direct API routesapp/Http/Controllers/v1contains your versioned API controllersapp/Http/DTOscontains request DTOsapp/Servicesholds application use casesapp/Repositoriescontains persistence-facing codedatabase/migrationscontains schema changesdatabase/seedscontains sample seed dataconfigcentralizes environment-driven app behaviorbincontains 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.phpphp 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
Contactdomain early with your real bounded context - Copy
.env.exampleto.envand explicitly review all security flags before deploying - Set
APP_KEYandJWT_SECRETbefore 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 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 celeris/api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
A PSR-7 compatible library for making CRUD API endpoints
Slim starter / Slim skeleton package to boost your development with Slim framework
Base Skeleton for Laravel Application
An awesome skeleton for modern PHP development.
Contao dummy frontend modules.
统计信息
- 总下载量: 6
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 36
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-24