teepluss/hmvc
Laravel HMVC。
2.0.0
2015-03-05 08:41 UTC
Requires
- php: >=5.3.0
- guzzle/guzzle: 3.9.1
Requires (Dev)
- illuminate/support: 4.1.x
This package is not auto-updated.
Last update: 2024-09-14 14:50:24 UTC
README
对于Laravel 4,请使用v1.x分支!
HMVC是一个用于内部请求的工具。
安装
要在您的composer.json
文件中获取HMVC的最新版本,只需要求它即可。
"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