sf4/api
Composer 安装命令:
composer require sf4/api
包简介
Simple rest API for Symfony 4
README 文档
README
Simple rest API for Symfony 4
Structure
If any of the following are applicable to your project, then the directory structure should follow industry best practices by being named the following.
bin/
config/
src/
tests/
vendor/
Install
Via Composer
$ composer require Sf4/Api
Usage
config/routes.yaml
api_default: path: / methods: [GET, OPTIONS] api_site: path: /site/{token} methods: [GET, OPTIONS]
config/services.yaml
services: parameters: # ... api_token: '%env(resolve:API_TOKEN)%' # ... Sf4\Api\Services\TagAwareCacheAdapter: ~ Sf4\Api\Services\CacheAdapterInterface: '@Sf4\Api\Services\TagAwareCacheAdapter' Sf4\Api\Repository\RepositoryFactory: class: Sf4\Api\Repository\RepositoryFactory arguments: $entityManager: '@Doctrine\ORM\EntityManagerInterface' $entities: [] Sf4\Api\EventSubscriber\RequestSubscriber: ~ Sf4\Api\RequestHandler\RequestHandlerInterface: class: Sf4\Api\RequestHandler\RequestHandler calls: - method: setEntityManager arguments: - '@Doctrine\ORM\EntityManagerInterface' - method: setTranslator arguments: - '@Symfony\Component\Translation\TranslatorInterface' - method: setDispatcher arguments: - '@Symfony\Component\EventDispatcher\EventDispatcherInterface' - method: setRepositoryFactory arguments: - '@Sf4\Api\Repository\RepositoryFactory' - method: setCacheAdapter arguments: - '@Sf4\Api\Services\CacheAdapterInterface' - method: setSites arguments: - - { site: 'parent', url: null, token: null } # - { site: 'parent', url: 'parent.example.com', token: 'API_TOKEN' } # - { site: 'example', url: 'site.example.com', token: 'API_TOKEN' } - method: setAvailableRoutes arguments: - api_default: 'Sf4\Api\Request\DefaultRequest' api_site: 'Sf4\Api\Request\SiteRequest'
config/packages/translation.yaml
framework:
# ...
translator:
# ...
paths:
# ...
- '%kernel.project_dir%/vendor/sf4/api/src/translations'
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email siim.liimand@gmail.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
sf4/api 适用场景与选型建议
sf4/api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 94 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 01 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「sf4」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 sf4/api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sf4/api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 sf4/api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Symfony bundle with static helper functions for checking coding pre-/post-conditions
Populator is a simple Array-To-Object library which transforms arrays into a given object
User module
Symfony 4.x FAQ bundle
Simple security package for Symfony 4
统计信息
- 总下载量: 94
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-01-17