arsengoian/viper-framework
Composer 安装命令:
composer require arsengoian/viper-framework
包简介
A lightweight multi-purpose PHP MVC framework
关键字:
README 文档
README
Viper is a lightweight universal PHP MVC framework with its own models and templating engine
Starting developing on Viper is as easy as typing in the console:
composer create-project arsengoian/viper PROJECT_NAME dev-master
and configuring DB credentials.
To check out the application build which is deployed with this command (or contribute) check out: https://github.com/arsengoian/viper
Configuration
The web application is configured by an array of YAML files at config/ directory. They contain a list of instructions on every setting. local.yaml contains configuration related to the current server environment while global.config sets up overall application settings.
Settings may be accessed at any time using Config class:
if (Config::get('DEBUG')) // From local.yaml -> local.yaml and global.yaml don't need a preffix return Config::get('Bots.VERIFY_TOKEN') // From bots.yaml
Features
YAML routing
Requests are routed automatically, for example a GET request to http://website.com/chairs will invoke the get method of ChairsController
Routing example:
welcome: DefaultController # directs DOMAIN/welcome -> DefaultController::get($http_params) hello: DefaultController.main # directs DOMAIN/hello -> DefaultController::main($http_params) products: # 1-level hierarchies are also supported parse: DefaultController count: DefaultController.main
Easy-to-use controllers and built-in validation
A controller function implementing a POST request:
public function post (...$args): ?Viewable { $v = new Required($this -> params()); // Create validator $v -> email('email'); // Validate "email" field Client::registerWithImages($this -> params(), $this -> files()); // Create new model in the database return new RedirectView('/'); // Redirect to main page }
Auto-completing models
Viper deals with databases automatically, miminizing the need to edit SQL manually. A YAML setup like this:
allowOverwrite: true fields: fname: VARCHAR(255) NOT NULL lname: VARCHAR(255) NOT NULL email: VARCHAR(255) NOT NULL age: INT NOT NULL img: TEXT NOT NULL
will create the needed database structure if needed and update it along with the file if needed.
Filters
Will be applied to all routes before any controller actions:
class Application extends \Viper\Core\Application { /** * Defines the list of filters to be run * before any controller actions * @return FilterCollection */ protected function declareFilters (): FilterCollection { return new FilterCollection([ LocalizationFilter::class, Authorization::class ]); } }
Logging and utilities
Viper supports built-in logging and a collection of useful utilities, including caching, advanced string handling etc.
Caching capabilities
All views and parsed .yaml files are recovered, if possible, from cache
Features in early development
- Background processes and services
- Windows background tasks
- Viper templating engine
- Console commands
- Full Mysql support
- Full SQL Server support
- Other SQL dialects support
- Numerous feature and structure improvements
Contributing and development
Since the framework is on an early stage of development, it may feature structural irreversable changes without reverse compatibility.
Please contribute to the project if you also feel passionate about making PHP development more elegant and intuitive =)
arsengoian/viper-framework 适用场景与选型建议
arsengoian/viper-framework 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 284 次下载、GitHub Stars 达 2, 最近一次更新时间为 2017 年 12 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「viper」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 arsengoian/viper-framework 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 arsengoian/viper-framework 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 arsengoian/viper-framework 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Grab your environment files from ViperLab.
Viper application installer.
High-performance, opinionated PHP 8 web framework with O(1) routing, parallel async MySQL, type-safe asset bridge, and React-island frontend
Laravel plugin for Viper
The skeleton application for the Geoffrey agent framework.
统计信息
- 总下载量: 284
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 6
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2017-12-18