mcshane/chem-mvc
Composer 安装命令:
composer require mcshane/chem-mvc
包简介
light weight mvc framework for php
README 文档
README
A lightweight, highly use-case configurable, extensible, easy to integrate MVC framework with an implemented strict custom class mapping and casting process for controller action parameter data types(objects specifically)
Installing
Install through composer with:
composer require mcshane/chem-mvc
Start faster with a template
Just replace 'my-project' with the name of your project
composer create-project eadrom/chemmvc-template my-project
Delete the newly installed composer files in 'my-project' root and cd to 'my-project'/app/ and run
composer install
The project structure is now setup and composer dependencies installed. You're ready to start building your web project.
To the controllers.
Usage
Chem MVC works off of a routing catalyst that assumes a url stucture of
/ControllerName/ActionName/Params
Take the following url for example
https://my-site.cool/
With Chemistry MVC's default routing, this url would invoke the '/home/index' action. 'home' being the default controller name and 'index' being the default action name. In turn the above url would be equivilant to.
https://my-site.cool/home/index
While these routing behaviours can be altered, this will assume you keep them the same.
Traverse your project to my-project/app/controllers/homeController.php
It should look as follows from a fresh install of the template
<?php
namespace app\controllers;
use ChemMVC\controller as Controller;
class homeController extends Controller
{
function index(){
return parent::view();
}
}
Simply enough, this homeController Class has one index Action. The index action calls the extended ChemMVC\controller class' view method. This method automagically locates the file my-project/app/views/home/index.php. This behaviour is possible for any action in any controller. Where controller name is the directory and the action name is the file name + '.php'
e.g. with homeController as
class homeController extends Controller
{
function couldBeCooler(){
return parent::view();
}
}
then
https://my-site.cool/home/couldBeCooler
would process and return the result of my-project/app/views/home/couldBeCooler.php just like that.
More to Come
Got any ideas for improvements? Fork this repo and make your art. I haven't even talked about TDBM(linked below).
Depenedency List(and reasons why they are here):
- TDBM - Modeling your database into usable php classes with CRUD operations, data structuring and data requirements built in.
mcshane/chem-mvc 适用场景与选型建议
mcshane/chem-mvc 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 04 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mcshane/chem-mvc 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mcshane/chem-mvc 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 38
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-04-11