modera/direct-bundle
Composer 安装命令:
composer require modera/direct-bundle
包简介
Symfony ExtDirect Bundle
关键字:
README 文档
README
ModeraDirectBundle is an implementation of ExtDirect specification to Symfony framework.
Installation
Step 1: Download the Bundle
composer require modera/direct-bundle:5.x-dev
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
This bundle should be automatically enabled by Flex.
In case you don't use Flex, you'll need to manually enable the bundle by
adding the following line in the config/bundles.php file of your project:
<?php // config/bundles.php return [ // ... Modera\DirectBundle\ModeraDirectBundle::class => ['all' => true], ];
Step 3: Add routing
// config/routes.yaml direct: resource: "@ModeraDirectBundle/Resources/config/routing.yml"
How to use
Add the ExtDirect API into your page
If you is using Twig engine, only add the follow line in your views page at the script section:
<script type="text/javascript" src="{{ url('api') }}"></script>
Or if you are not using a template engine:
<script type="text/javascript" src="/api.js"></script>
Expose your controller methods to ExtDirect Api
// .../Acme/DemoBundle/Controller/ExampleController.php namespace Acme\DemoBundle\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Modera\DirectBundle\Annotation\Remote; use Modera\DirectBundle\Annotation\Form; class ExampleController extends AbstractController { /** * Single exposed method. * * @Remote // this annotation expose the method to API * * @param array $params * @return string */ public function indexAction(array $params) { return 'Hello ' . $params['name']; } /** * An action to handle forms. * * @Remote // this annotation expose the method to API * @Form // this annotation expose the method to API with formHandler option * * @param array $params Form submitted values * @param array $files Uploaded files like $_FILES */ public function testFormAction(array $params, array $files) { // your proccessing return true; } }
Call the exposed methods from JavaScript
// 'AcmeDemo' is the Bundle name without 'Bundle' // 'Example' is the Controller name without 'Controller' // 'index' is the method name without 'Action' Actions.AcmeDemo_Example.index({ name: 'ExtDirect' }, function(r) { alert(r); });
Licensing
This bundle is under the MIT license. See the complete license in the bundle: Resources/meta/LICENSE
modera/direct-bundle 适用场景与选型建议
modera/direct-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.88k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2015 年 01 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「extjs」 「extdirect」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 modera/direct-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 modera/direct-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 modera/direct-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Utilities for easier integration of ExtJs on server-side.
ExtDirect implementation for Symfony2
Ext-JS / Sencha Touch RPC Intergration Module for Zend Framework 2
Ext.Direct integration with PHP
PHP/ExtJS-based web development platform
MySQL Workbench Schema Exporter for Sencha ExtJS3 and ExtJS4
统计信息
- 总下载量: 5.88k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 18
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-01-12