hakuryo/slim-api-template
Composer 安装命令:
composer create-project hakuryo/slim-api-template
包简介
A SLIM API template with firebase php jwt
README 文档
README
This project is a SLIM API template bundled with the following composer package :
- php: >=7.4
- firebase/php-jwt: ^6.3
- hakuryo/database-client: ^1.3
- monolog/monolog: ^3.3.1
- slim/psr7: ^1.5
- slim/slim: ^4.9
Requirement
Mandatory
- PHP 7.4+
- PHP module :
- php-json
- php-pdo
- php-mysql
Optional
- PHP module :
- oci8 How to install OCI8
- pdo_oci How to install PDO_OCI
Install
composer create-project hakuryo/slim-api-template [local_path_of_your_project]
Configuration
This template is initialized by the Config class. The class load an INI file to configure the application.
⚠️
The default location is__DIR__ . "/config/config.ini". Please take note that's NOT A GOOD location for production. You SHOULD place the config file outside your web root.If you can not place the INI file outside your web root please consider using ACL like htaccess to prevent the reading of the file.
Below a sample config file.
# Global APP config sample [app] base_path = "/" # JWT token config sample [jwt] key = My_super_private_key; private Key for JWT generation algorithm = HS256; Algorithm for JWT signature generation token_duration = 28800 issuer = my-server.example.com # hakuryo/ldap-client config sample [ldap] HOST = "ldap.example.com" USER = "uid=my_login,dc=example,dc=com" DN = "dc=example,dc=com" PWD = "ldap_pwd" # hakuryo/database-client config sample for mysql [db] HOST = "db.example.com"; DB = "my_db"; USER = "my_user"; PWD = "my_user_pwd" PORT = 3306 DRIVER = "mysql" # hakuryo/database-client config sample for oracle [oci] HOST = "oracle.example.com"; DB = "my_oracle_db"; USER = "my_user"; PWD = "my_owd"; PORT = 12345 DRIVER = "oci" [logger] # Define the type of logger could be ErrorLogHandler,StreamHandler or RotatingFileHandler logger_class = "RotatingFileHandler" # Programmatic name of the logger logger_name = "myLogger" # Logger level could be one of debug,info,notice,warning,error,critical,emergency logger_level = "debug" # Define the Line format in the logger logger_line_format = "%datetime% %level_name% %message%" # Absolute path of the Log file.only used when logger_class is StreamHandler or RotatingFileHandler log_file_path = "/var/log/apache2/my_application.log" # File name format for RotatingFileHandler class log_file_name_format = "{date}-{filename}" # Date format used in log_file_name_format for RotatingFileHandler class log_file_name_date_format = "Y-m-d"
hakuryo/slim-api-template 适用场景与选型建议
hakuryo/slim-api-template 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 37 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 03 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 hakuryo/slim-api-template 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hakuryo/slim-api-template 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 37
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-03-28