jaxon-php/jaxon-yii
Composer 安装命令:
composer require jaxon-php/jaxon-yii
包简介
Jaxon library integration for the Yii Framework
README 文档
README
This package integrates the Jaxon library into the Yii framework. It requires the version 2.0.11 or newer.
Installation
Add the following lines in the composer.json file, and run the composer update command.
"require": { "jaxon-php/jaxon-yii": "^4.0" }
Or run the composer require jaxon-php/jaxon-yii command.
This package provides a filter that must be attached to routes to pages where the Jaxon features are enabled.
This is an example of a Yii controller using the Jaxon library.
namespace app\controllers; use Yii; use yii\web\Controller; use Jaxon\Yii\Filter\JaxonConfigFilter; class DemoController extends Controller { public function behaviors() { return [ [ 'class' => JaxonConfigFilter::class, 'only' => ['index', 'jaxon'], ], ]; } /** * Process Jaxon ajax requests. This route must be the same that is set in the Jaxon config. */ public function actionJaxon() { $jaxon = jaxon()->app(); if(!$jaxon->canProcessRequest()) { // Jaxon failed to find a plugin to process the request return; // Todo: return an error message } return $jaxon->processRequest(); } /** * Insert Jaxon js and css codes in the page. */ public function actionIndex() { // Set the layout $this->layout = 'demo'; // Get the Jaxon module $jaxon = jaxon()->app(); return $this->render('index', [ 'jaxonCss' => $jaxon->css(), 'jaxonJs' => $jaxon->js(), 'jaxonScript' => $jaxon->script() ]); } }
Before it prints the page, the controller calls the $jaxon->css(), $jaxon->js() and $jaxon->script() functions,
to get the CSS and javascript codes generated by Jaxon which are inserted into the page.
Configuration
The Jaxon library settings are defined in the @app/config/jaxon.php file, and separated into two sections.
The options in the lib section are those of the Jaxon core library, while the options in the app sections are those of the Jaxon application.
The following options can be defined in the app section of the config file.
| Name | Description |
|---|---|
| directories | An array of directory containing Jaxon application classes |
| views | An array of directory containing Jaxon application views |
By default, the views array is empty. Views are rendered from the framework default location.
There's a single entry in the directories array with the following values.
| Name | Default value | Description |
|---|---|---|
| directory | @app/jaxon/classes | The directory of the Jaxon classes |
| namespace | \Jaxon\App | The namespace of the Jaxon classes |
| separator | . | The separator in Jaxon class names |
| protected | empty array | Prevent Jaxon from exporting some methods |
Usage
The Jaxon classes
The Jaxon classes can inherit from \Jaxon\App\CallableClass.
By default, they are located in the @app/jaxon/ajax dir of the Yii application, and the associated namespace is \Jaxon\Ajax.
This is an example of a Jaxon class, defined in the @app/jaxon/ajax/HelloWorld.php file.
namespace Jaxon\Ajax; class HelloWorld extends \Jaxon\App\CallableClass { public function sayHello() { $this->response->assign('div2', 'innerHTML', 'Hello World!'); } }
Contribute
- Issue Tracker: github.com/jaxon-php/jaxon-yii/issues
- Source Code: github.com/jaxon-php/jaxon-yii
License
The package is licensed under the BSD license.
jaxon-php/jaxon-yii 适用场景与选型建议
jaxon-php/jaxon-yii 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.73k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 06 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「ajax」 「yii」 「Jaxon」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jaxon-php/jaxon-yii 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jaxon-php/jaxon-yii 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jaxon-php/jaxon-yii 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
Selenium4 (WebDriver) driver for Mink framework
laravel middleware to allow ajax only calls
Sitemap crawler/generator. For the given URL it will return sitemap XML file with URLs and images.
Priveate for SkeekS CMS
This is a laravel 4 package for the server and client side of datatables at http://datatables.net/
统计信息
- 总下载量: 1.73k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-06-15