mercury/framework
Composer 安装命令:
composer require mercury/framework
包简介
MVC framework with admin interface to manage files
README 文档
README
This is another Micro MVC framework. This is unique in a way that configuration is done via a web interface and stored in the database. All you have to do is just write code that matters to your application.
Installation
You can always download the files and mess with it but good luck with that. I recommend using the composer. Install composer in your system and copy paste the following in your composer.json file
{
"minimum-stability": "dev",
"require": {
"mercury/framework": "dev-master"
},
"autoload": {
"psr-4": {
"Mercury\\App\\": "application"
}
},
"extra": {
"assets-dir" : "assets/vendors/"
}
}
Then run the composer
composer install -o
The framework uses database for its operation so create a DB with the following
DROP TABLE IF EXISTS `m_blueprint`;
CREATE TABLE `m_blueprint` (
`blueprintid` int(11) unsigned NOT NULL AUTO_INCREMENT,
`type` varchar(10) DEFAULT NULL,
`content` longtext,
PRIMARY KEY (`blueprintid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `m_blueprint` (`blueprintid`, `type`, `content`)
VALUES
(1, 'CONTROLLER', '<?\nnamespace Mercury\\App\\{ModuleName}\\Controllers;\n\nuse Mercury\\Helper\\Controller;\n\nclass SampleController extends Controller {\n\n\n public function initcontroller() {\n\n /**\n * Avoid defining a constructor use this method instead\n */\n }\n\n public function indexAction() {\n\n echo \"Sample file\";\n }\n\n}'),
(2, 'VIEW', '<?php $this->layout($gs_template, $ga_templatedata) ?>'),
(3, 'MODEL', '<?\nnamespace Mercury\\App\\{ModuleName}\\Models;\n\nuse Mercury\\Helper\\Model;\n\nclass SampleModel extends Model {\n\n\n protected function initmodel() {\n\n // Set this because the table name is not in standard format\n $this->settable(\'some_table\');\n\n }\n\n}'),
(4, 'HELPER', '<?\nnamespace Mercury\\App\\Helpers;\n\nuse Mercury\\Helper\\Core;\n\nclass [HelperName] extends Core {\n\n}');
DROP TABLE IF EXISTS `m_module`;
CREATE TABLE `m_module` (
`moduleid` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`core` tinyint(1) unsigned zerofill DEFAULT NULL,
PRIMARY KEY (`moduleid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `m_page`;
CREATE TABLE `m_page` (
`pageid` int(11) unsigned NOT NULL AUTO_INCREMENT,
`label` varchar(100) DEFAULT NULL,
`name` varchar(100) DEFAULT NULL,
`content` longtext,
`type` varchar(20) DEFAULT NULL,
`moduleid` int(11) DEFAULT NULL,
`controllerid` int(11) DEFAULT NULL,
`templateid` int(11) DEFAULT NULL,
`core` tinyint(1) unsigned zerofill DEFAULT NULL,
`created` datetime DEFAULT NULL,
`deleted` tinyint(1) unsigned zerofill DEFAULT NULL,
PRIMARY KEY (`pageid`),
KEY `type` (`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `m_route`;
CREATE TABLE `m_route` (
`routeid` int(11) unsigned NOT NULL AUTO_INCREMENT,
`requesturi` varchar(100) DEFAULT NULL,
`moduleid` int(11) DEFAULT NULL,
`controllerid` int(11) DEFAULT NULL,
`action` varchar(50) DEFAULT NULL,
`method` varchar(50) DEFAULT NULL,
`core` tinyint(1) DEFAULT NULL,
`created` datetime DEFAULT NULL,
PRIMARY KEY (`routeid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
NGINX Config
In addition to your other config you need to have the following
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~* (.+)\.(?:\d+)\.(js|css|png|jpg|jpeg|gif)$ {
try_files $uri $1.$2;
}
Thats it! you have just installed an awesome framework ;)
Usage
Not much documentation at this stage, might do it later when I get some time but use the following content in your index.php to start with
<?
use Mercury\Helper\Application;
use Mercury\Helper\Profiler;
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Autoload
require('vendor/autoload.php');
// Init the profiler
$go_profiler = new Profiler();
// Create the application
$go_app = new Application();
// Run the application
$go_app->runapp();
// Show the profiling result
$go_profiler->showresult();
?>
mercury/framework 适用场景与选型建议
mercury/framework 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 31 次下载、GitHub Stars 达 2, 最近一次更新时间为 2016 年 01 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mercury/framework 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mercury/framework 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 31
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-01-14