cravler/faye-app-bundle
Composer 安装命令:
composer require cravler/faye-app-bundle
包简介
无描述信息
README 文档
README
This bundle depends on faye-app.
Installation
Step 1: Download the Bundle
composer require cravler/faye-app-bundle:2.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 [ // ... Cravler\FayeAppBundle\CravlerFayeAppBundle::class => ['all' => true], ];
Step 3: Add routing
# config/routes.yaml cravler_faye_app: resource: "@CravlerFayeAppBundle/Resources/config/routing.yaml"
Step 4: Include Javascript
To include the relevant javascript libraries necessary for FayeApp, add these to your root layout file.
<!-- .../Acme/DemoBundle/Resources/views/layout.html.twig --> <script type="text/javascript" src="..."></script> {{ faye_app_javascript() }}
Usage
Create entry-point
<?php // .../Acme/DemoBundle/EntryPoint/Example.php namespace Acme\DemoBundle\EntryPoint; use Cravler\FayeAppBundle\EntryPoint\AbstractEntryPoint; class Example extends AbstractEntryPoint { public function getId() { return 'acme-demo.example'; } }
Register entry-point
<!-- .../Acme/DemoBundle/Resources/config/services.xml --> <services> ... <service id="acme.demo.entry_point.example" class="Acme\DemoBundle\EntryPoint\Example"> <call method="setEntryPointManager"> <argument type="service" id="cravler_faye_app.service.entry_point_manager" /> </call> <tag name="cravler_faye_app.entry_point" /> </service> ... </services>
Subscribing to channels
<script type="text/javascript"> var exampleEntryPoint = FayeApp.createEntryPoint('acme-demo.example'); var subscription = exampleEntryPoint.subscribe('/foo', function(message) { console.log('[foo] Handle message: ', message); }); subscription.then(function() { console.log('[foo] Subscription is now active!'); }, function(error) { console.log('[foo] Subscription problem: ' + error.message); }); </script>
Sending messages
<script type="text/javascript"> var exampleEntryPoint = FayeApp.createEntryPoint('acme-demo.example'); var publication = exampleEntryPoint.publish('/foo', { text: 'Hi there' }); publication.then(function() { console.log('[foo] Message received by server!'); }, function(error) { console.log('[foo] There was a problem: ' + error.message); }); </script>
Configuration
The default configuration for the bundle looks like this:
cravler_faye_app: example: false user_provider: false #security.user.provider.concrete.[provider_name] route_url_prefix: /faye-app use_request_uri: false secret: ThisTokenIsNotSoSecretChangeIt app: scheme: ~ host: 127.0.0.1 port: ~ mount: /pub-sub options: {}
License
This bundle is under the MIT license. See the complete license in the bundle:
LICENSE
cravler/faye-app-bundle 适用场景与选型建议
cravler/faye-app-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 53.58k 次下载、GitHub Stars 达 1, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「sockets」 「WebSockets」 「Node.js」 「pubsub」 「faye」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 cravler/faye-app-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 cravler/faye-app-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 cravler/faye-app-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The bundle for easy using json-rpc api on your project
Synchronous Message Passing Framework for PHP
Thruway WAMP router core
A Laravel Nova tool to integrate websockets into Nova.
Bundle Symfony DaplosBundle
Binding for raw sockets (ext-sockets) in reactphp
统计信息
- 总下载量: 53.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 19
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知