Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Faye App Bundle Laravel Package

cravler/faye-app-bundle

View on GitHub
Deep Wiki
Context7

CravlerFayeAppBundle

This bundle depends on faye-app.

Installation

Step 1: Download the Bundle

composer require cravler/faye-app-bundle:4.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.php"

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(): string
    {
        return 'acme-demo.example';
    }
}

Register entry-point

<!-- .../Acme/DemoBundle/Resources/config/services.xml -->

<services>
    ...
    <service id="Acme\DemoBundle\EntryPoint\Example"
        autoconfigure="true"
        autowire="true"
        public="false"
    />
    ...
</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
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
besmartand-pro/php-quality-config
sentix/ai-chatbot
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity