此包已被 放弃 并不再维护。未建议替代包。

Laravel HMVC。

2.0.0 2015-03-05 08:41 UTC

This package is auto-updated.

Last update: 2021-02-07 23:21:11 UTC


README

针对 Laravel 4,请使用 v1.x 分支

HMVC 是一个用于进行内部请求的工具。

安装

要获取 HMVC 的最新版本,只需在您的 composer.json 文件中引入它。

"teepluss/hmvc": "dev-master"

然后您需要运行 composer install 来下载它,并更新自动加载器。

一旦安装了 HMVC,您需要将服务提供者注册到应用程序中。打开 config/app.php 并找到 providers 键。

'providers' => array(

    'Teepluss\Hmvc\HmvcServiceProvider'

)

HMVC 还包含一个门面,它提供用于创建集合的静态语法。您可以在 config/app.php 文件的 aliases 键中注册门面。

'aliases' => [

    'HMVC' => 'Teepluss\Hmvc\Facades\HMVC',

]

使用方法

HMVC 帮助您处理内部请求。

内部测试请求。

// GET Request.
HMVC::get('user/1');

// POST Request.
HMVC::post('user', array('title' => 'Demo'));

// PATCH Request.
HMVC::patch('user/1', array('title' => 'Changed'));

// PUT Request.
HMVC::put('user/1', array('title' => 'Changed'));

// DELETE Request.
HMVC::delete('user/1');

// Internal request with domain route.
HMVC::invoke('/someinternalpath', 'post', array('param' => 1))

// You can make remote request without changing code also.
HMVC::post('http://api.github.com', array('username' => 'teepluss'));

// Request remote with invokeRemote.
HMVC::invokeRemote('http://api.github.com', 'post', array('username' => 'teepluss'));

// Configure remote client.
$config = array('auth' => array('admin', 'admin'));
echo HMVC::configureRemoteClient($config)->get('http://127.0.0.1:9200');

// Get Guzzle to use other features.
$guzzle = HMVC::getRemoteClient();

使用 Guzzle 作为适配器的远程请求。

支持或联系

如果您遇到任何问题,请联系 teepluss@gmail.com

Support via PayPal