jaxon-php/jaxon-cake
Composer 安装命令:
composer require jaxon-php/jaxon-cake
包简介
Jaxon library integration for the CakePHP 3 framework
README 文档
README
This package integrates the Jaxon library into the CakePHP framework.
Installation
The version 4 of the package requires CakePHP version 4.
Install the package with Composer.
composer require jaxon-php/jaxon-cake ^5.0
Or
{
"require": {
"jaxon-php/jaxon-cake": "^5.0",
}
}
And run composer install.
Load the Jaxon plugin in the src/Application.php file.
/** * Load all the application configuration and bootstrap logic. * * @return void */ public function bootstrap(): void { ... // Load more plugins here $this->addPlugin(\Jaxon\Cake\JaxonPlugin::class, ['routes' => true]); }
Load the Jaxon view helper in the src\View\AppView.php file.
/** * Initialization hook method. * * Use this method to add common initialization code like loading helpers. * * e.g. `$this->loadHelper('Html');` * * @return void */ public function initialize(): void { $this->loadHelper('Jaxon/Cake.Jaxon'); }
Routing and middlewares
This package provides two middlewares, one to load the Jaxon config, and the other to process Jaxon requests. The Jaxon config middleware must be attached to the routes to all the pages where the Jaxon features are enabled, while the later must be attached to the controller action that processes Jaxon requests.
use Jaxon\Cake\Middleware\ConfigMiddleware as JaxonConfigMiddleware; $routes->scope('/', function (RouteBuilder $builder) { // Register Jaxon middlewares $builder->registerMiddleware('jaxon.config', new JaxonConfigMiddleware()); // Apply the "jaxon.config" middleware to routes to pages that require Jaxon. $builder->applyMiddleware('jaxon.config'); ... });
Usage
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 CakePHP 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 | ROOT . '/jaxon/App' | 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 javascript and CSS code
The Jaxon view helper provides functions to insert the Jaxon javascript and CSS code into a page.
<!-- The Jaxon CSS code --> <?= $this->Jaxon->css() ?>
<!-- The Jaxon javascript includes --> <?= $this->Jaxon->js() ?>
<!-- The Jaxon javascript code --> <?= $this->Jaxon->script() ?>
The Jaxon classes
The Jaxon classes can inherit from \Jaxon\App\CallableClass.
By default, they are located in the ROOT/jaxon/App dir of the CakePHP application, and the associated namespace is \Jaxon\App.
This is an example of a Jaxon class, defined in the ROOT/jaxon/App/HelloWorld.php file.
namespace Jaxon\App; class HelloWorld extends \Jaxon\App\CallableClass { public function sayHello() { $this->response->assign('div2', 'innerHTML', 'Hello World!'); } }
Contribute
- Issue Tracker: github.com/jaxon-php/jaxon-cake/issues
- Source Code: github.com/jaxon-php/jaxon-cake
License
The package is licensed under the BSD license.
jaxon-php/jaxon-cake 适用场景与选型建议
jaxon-php/jaxon-cake 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 89 次下载、GitHub Stars 达 1, 最近一次更新时间为 2016 年 12 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「cakephp」 「ajax」 「Jaxon」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jaxon-php/jaxon-cake 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jaxon-php/jaxon-cake 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jaxon-php/jaxon-cake 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
CakePHP 4.x AdminLTE Theme.
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.
Email Toolkit Plugin for CakePHP
This is a laravel 4 package for the server and client side of datatables at http://datatables.net/
统计信息
- 总下载量: 89
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-12-30