yiisoft/app-api
Composer 安装命令:
composer create-project yiisoft/app-api
包简介
Yii3 API project template
README 文档
README
Yii API application
An application template for a new API project
The package is an API application template. If you need console only or classic web please start with corresponding templates:
Requirements
- PHP 8.2 - 8.5.
Installation
Local installation
If you do not have Composer, you may install it by following the instructions at getcomposer.org.
Create a project:
composer create-project yiisoft/app-api myproject
cd myproject
Note
Ensure that Composer is executed with the same PHP version that will be used to run the application.
Copy the example environment file and adjust as needed:
cp .env.example .env
To run the app:
./yii serve
Now you should be able to access the application through the URL printed to console.
Usually it is http://localhost:8080.
Tip
The .env file is for local development only and is excluded from version control.
In production, configure environment variables via your server or container instead.
Installation with Docker
Warning
Docker compose version 2.24 or above is required.
Fork the repository, clone it, then:
cd myproject
make composer update
To run the app:
make up
To open the running app in your default browser:
make open
To stop the app:
make down
The application is available at http://localhost.
Other make commands are available in the Makefile and can be listed with:
make help
Directory structure
The application template has the following structure:
config/ Configuration files.
common/ Common configuration and DI definitions.
console/ Console-specific configuration.
environments/ Environment-specific configuration (dev/test/prod).
web/ Web-specific configuration.
docker/ Docker-specific files.
public/ Files publically accessible from the Internet.
index.php Entry script.
runtime/ Files generated during runtime.
src/ Application source code.
Api/ API action handlers and API-specific code.
Shared/ Shared API components (middleware, presenters, factories).
Console/ Console commands.
Shared/ Code shared between API and console applications.
bootstrap.php Application bootstrap (autoloading, environment setup).
Environment.php Environment configuration class.
tests/ A set of Codeception tests for the application.
Api/ API endpoints tests.
Console/ Console command tests.
Functional/ Functional tests.
Unit/ Unit tests.
vendor/ Installed Composer packages.
Makefile Config for make command.
yii Console application entry point.
Testing
The template comes with ready to use Codeception configuration. To execute tests, in local installation run:
./vendor/bin/codecept build APP_ENV=test ./yii serve > ./runtime/yii.log 2>&1 & ./vendor/bin/codecept run
For Docker:
make codecept build make codecept run
Static analysis
The code is statically analyzed with Psalm. To run static analysis:
./vendor/bin/psalm
or, using Docker:
make psalm
Support
If you need help or have a question, check out Yii Community Resources.
License
The Yii3 API template is free software. It is released under the terms of the BSD License.
Please see LICENSE for more information.
Maintained by Yii Software.
Support the project
Follow updates
yiisoft/app-api 适用场景与选型建议
yiisoft/app-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.7k 次下载、GitHub Stars 达 101, 最近一次更新时间为 2020 年 11 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「rest」 「api」 「app」 「yii3」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 yiisoft/app-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 yiisoft/app-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 yiisoft/app-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Make your bundle an application
A PSR-7 compatible library for making CRUD API endpoints
Api bundle
App Version Utility for CakePHP 2.x Applications
A Flickr wrapper to allow you to call the Flickr api with Guzzle as the backend.Goal is to have 100% Flickr api coverage rather than just upload/display photos (currently at 23%).
FAQ app for the Elefant CMS
统计信息
- 总下载量: 1.7k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 101
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2020-11-02