jaxon-php/jaxon-codeigniter
Composer 安装命令:
composer require jaxon-php/jaxon-codeigniter
包简介
Jaxon library integration for the CodeIgniter framework
关键字:
README 文档
README
This package integrates the Jaxon library into the CodeIgniter 4 framework.
Installation
The version 4 of the package requires CodeIgniter version 4.
Install the package with Composer.
composer require jaxon-php/jaxon-codeigniter ^4.0
Or
{
"require": {
"jaxon-php/jaxon-codeigniter": "^4.0",
}
}
And run composer install.
Filter
This package provides a filter that must be attached to the routes to all the pages where the Jaxon features are enabled.
In the app/Config/Routes.php file, a route must be defined for Jaxon requests.
// Add the Jaxon filter to Jaxon-enabled routes. $routes->get('/', 'Demo::index', ['filter' => JaxonConfigFilter::class]); // Jaxon request processing route. $routes->post('/jaxon', 'Demo::jaxon', ['filter' => JaxonConfigFilter::class]);
This is an example of a CodeIgniter controller using the Jaxon library.
namespace App\Controllers; use Jaxon\Demo\Ajax\Bts; use Jaxon\Demo\Ajax\Pgw; use function view; class Demo extends BaseController { public function index() { $jaxon = jaxon()->app(); // Print the page return view('demo/index', [ 'jaxonCss' => $jaxon->css(), 'jaxonJs' => $jaxon->js(), 'jaxonScript' => $jaxon->script(), 'pageTitle' => "CodeIgniter Framework", // Jaxon request to the Bts Jaxon class 'bts' => $jaxon->request(Bts::class), // Jaxon request to the Pgw Jaxon class 'pgw' => $jaxon->request(Pgw::class), ]); } public function jaxon() { $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(); } }
Configuration
Copy the config/Jaxon.php file in this package to the app/Config dir of the CodeIgniter app.
The settings in the config/Jaxon.php config file are 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 CodeIgniter 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 | 'jaxon/ajax' | The directory of the Jaxon classes |
| namespace | \Jaxon\Ajax | 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 jaxon/app dir of the CodeIgniter application, and the associated namespace is \Jaxon\Ajax.
This is a simple example of a Jaxon class, defined in the 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-codeigniter/issues
- Source Code: github.com/jaxon-php/jaxon-codeigniter
License
The package is licensed under the BSD license.
jaxon-php/jaxon-codeigniter 适用场景与选型建议
jaxon-php/jaxon-codeigniter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 203 次下载、GitHub Stars 达 5, 最近一次更新时间为 2016 年 06 月 15 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「ajax」 「codeigniter」 「Jaxon」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jaxon-php/jaxon-codeigniter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jaxon-php/jaxon-codeigniter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jaxon-php/jaxon-codeigniter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The CodeIgniter Redis package
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.
This is a laravel 4 package for the server and client side of datatables at http://datatables.net/
统计信息
- 总下载量: 203
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-06-15