wenprise/mvc
Composer 安装命令:
composer require wenprise/mvc
包简介
wenprise mvc framework.
README 文档
README
Add a MVC framework to wordpress, based on Themosis Framework .
Usage
Prerequisites
- Set permalink structure as
/%postname%/in Permalink Settings - Set Your homepage displays as
Your latest postsin Reading Settings
User composer to install
In your theme directory
$ composer require wenprise/mvc
add psr-4 autoload rule to composer.json
"autoload": { "psr-4": { "Theme\\": "app/" } },
the run the dump-autoload command
$ composer dump-autoload
Include the autoload and frame init fie to your theme`s functions.php file.
require_once( get_theme_file_path( 'vendor/autoload.php' ) ); require_once( get_theme_file_path( 'app/init.php' ) );
The directory structure
The structure of theme/app directory.
├── Controllers │ ├── AccountController.php ├── Models │ ├── Order.php ├── Providers │ └── RoutingService.php ├── init.php └── routes.php
Boot the framework in theme
the code in init.php
namespace Theme; use Theme\Providers\RoutingService; use Wenprise\Mvc\App; class Init { public function __construct() { $GLOBALS[ 'wenprise' ] = App::instance(); /* * 获取服务容器 */ $container = $GLOBALS[ 'wenprise' ]->container; /* * 注册主题视图路径 */ $container[ 'view.finder' ]->addLocation(get_theme_file_path('templates')); /* * 加载配置文件 */ $container[ 'config.finder' ]->addPaths([ get_theme_file_path('app/Config/'), ]); /** * 主题服务提供者 */ $providers = [ RoutingService::class, ]; foreach ($providers as $provider) { $container->register($provider); } } }
Routing Service
the code in RoutingService.php
namespace Theme\Providers; use Wenprise\Facades\Route; use Wenprise\Foundation\ServiceProvider; class RoutingService extends ServiceProvider { public function register() { Route::group( [ 'namespace' => 'Theme\Controllers', ], function () { require get_theme_file_path( 'app/routes.php' ); } ); } }
Routers
the code in routes.php
Route::prefix( 'account' )->group( function () { Route::match( [ 'get', 'post' ], 'register', 'AccountController@register' ); } );
Controller
Sampel Controller
namespace Theme\Controllers; use Wenprise\Route\BaseController; class AccountController extends BaseController { /** * User register controller * @return string */ public function register() { } }
Models
See: Wenprise Eloquent
Views
See https://laravel.com/docs/5.5/blade or https://twig.symfony.com/
wenprise/mvc 适用场景与选型建议
wenprise/mvc 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 266 次下载、GitHub Stars 达 0, 最近一次更新时间为 2018 年 01 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「wordpress」 「wenprise」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 wenprise/mvc 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 wenprise/mvc 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 wenprise/mvc 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
Must-use plugin integrating WordPress with the Upsun platform: environment awareness, router-cache friendliness, safe preview clones, deploy migrations, Site Health checks, and a wp upsun CLI command.
High-performance, opinionated PHP 8 web framework with O(1) routing, parallel async MySQL, type-safe asset bridge, and React-island frontend
The skeleton application for the Geoffrey agent framework.
Inertia.js server-side adapter for PHP. Handles full visits, Inertia XHR visits, asset-version 409 handshakes and partial reloads. Framework-agnostic, with transparent WordPress integration.
Framework used for the Darflen social media project.
统计信息
- 总下载量: 266
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2018-01-23