ursuleacv/wallaby
Composer 安装命令:
composer require ursuleacv/wallaby
包简介
A simple lightweight framework for building small apps in PHP
README 文档
README
A simple lightweight MVC framework for building small apps in PHP.
Built in support for layouts, themes, routing.
Usage
Create composer.json file
{
"require": {
"php": ">=5.6.0",
"ext-json": "*",
"ext-pdo": "*",
"ursuleacv/wallaby": "dev-master"
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
}
}
Run composer install
Create a project with the following structure
app
Controllers
BaseController.php
HomeController.php
Models
User.php
config
router.php
app.php
public
themes
default
views
home
index.php
login.php
layouts
main.php
beta
views
index.php
server.php
Example BaseController.php
<?php namespace App\Controllers; use Wallaby\Base\Controller; class BaseController extends Controller { /** * * * @return void */ public function __construct() { parent::__construct(); $this->theme = 'default'; $this->layout = 'layouts/main'; } }
Example HomeController.php
<?php namespace App\Controllers; class HomeController extends BaseController { /** * * * @return void */ public function __construct() { parent::__construct(); $this->theme = 'default'; // You can override the theme $this->layout = 'layouts/main'; } /** * @return void */ public function autoLogin() { // } }
public/index.php
<?php date_default_timezone_set('UTC'); require __DIR__.'/../vendor/autoload.php'; require __DIR__.'/../server.php';
server.php
<?php use Wallaby\Router; error_reporting(-1); defined('ROOT') or define('ROOT', __DIR__); defined('PUBLIC_DIR') or define('PUBLIC_DIR', 'public'); $config = require_once __DIR__ . '/config/app.php'; $debug = isset($config['debug']) ? $config['debug'] : false; defined('APP_DEBUG') or define('APP_DEBUG', $debug); $url = trim($_SERVER['REQUEST_URI'], '/'); $configRouter = require_once ROOT . '/config/router.php'; $router = new Router($configRouter); $router->start($url);
config/app.php
<?php return [ 'appName' => 'My App Name', 'appBaseUrl' => 'http://localhost', // no trailing slash 'theme' => 'default', 'version' => 'v1.0.0', ];
config/router.php
this will automatically match all routes with the following format
controller/action/param1/param2
controller/action/?param1=value1¶m2=value2
Ex:
http:localhost/site/register
http:localhost/site/contact
http:localhost/product/edit/123
<?php return [ 'baseAction' => 'index', 'baseController' => 'home', 'errorHandler' => 'home/error', 'routes' => '^(?<controller>[a-z-A-Z]+)?/?(?<action>[a-z-A-Z]+)?/?(?<parameter>.*[a-z0-9/-])?/?(?<query>\?.*)?$', ];
ursuleacv/wallaby 适用场景与选型建议
ursuleacv/wallaby 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 161 次下载、GitHub Stars 达 1, 最近一次更新时间为 2017 年 05 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「mvc」 「micro」 「Simple」 「wallaby」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ursuleacv/wallaby 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ursuleacv/wallaby 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ursuleacv/wallaby 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Kinikit - PHP Application development framework MVC component
Anax htmlform module.
Micro Active Record library in PHP, support chain calls, events, and relations.
Onix Micro Framework
PHP classes for database handling upon PDO
Alfabank REST API integration
统计信息
- 总下载量: 161
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-05-23