Weave 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

Websocket Bundle Laravel Package

gonzakpo/websocket-bundle

gonzakpo/websocket-bundle is a WebSocket package for Laravel/PHP projects, offering tools to establish WebSocket connections, handle real-time messaging, and add live updates to your application. It aims to simplify WebSocket integration with a bundle-style setup and straightforward configuration.

View on GitHub
Deep Wiki
Context7

Getting Started

  1. Install the package via Composer (assuming standard Laravel package installation).
  2. Publish the configuration file:
    php artisan vendor:publish --provider="Vendor\Package\ServiceProvider" --tag="config"
    
  3. Add the following environment variables to your .env (matching the v2.1 release defaults):
    MEMCACHE_SERVER=127.0.0.1
    MEMCACHE_PORT=11211
    SESSION_PREFIX=sess_
    SESSION_EXPIRE=86400
    
  4. Set your session driver to use memcached (if the package provides a driver) or configure the package to use these settings for client data caching.
  5. First use case: Replace file-based sessions with memcached for multi-server setups. Confirm it works by visiting a page that writes to the session and checking that the key sess_<session_id> appears in memcached (telnet 127.0.0.1 11211 then get sess_...).

Implementation Patterns

  • Session driver replacement: In config/session.php, set 'driver' => 'memcached' (or the driver name provided by the package). Point the package’s memcache_server / memcache_port config to your memcached cluster.
  • Environment‑specific prefixes: Use SESSION_PREFIX to namespace sessions per environment (e.g. staging_sess_, prod_sess_) so multiple apps can share a memcached pool without collisions.
  • Expiration tuning: Set SESSION_EXPIRE to match Laravel’s session.lifetime (in seconds). The package uses this value when writing to memcached. For long‑lived “remember me” sessions, consider a higher value or a separate prefix.
  • Caching client data: If the package also exposes a cache store, you can use it via Cache::store('memcached') to store frequently accessed client records. Reuse the same memcache_server/memcache_port config.
  • Multi‑server setups: List multiple memcached servers in memcache_server (comma‑separated if supported by the package). Use consistent hashing (default in most PHP memcached clients) to distribute keys.
  • Testing: In phpunit.xml, set SESSION_DRIVER=array or mock the memcached client to avoid hitting a real server during tests.

Gotchas and Tips

  • Memcached PHP extension required: Ensure ext-memcached is installed and enabled. The package will not work with the older memcache extension.
  • Connection failures are silent: By default, memcached may fail silently if the server is unreachable. Add a health check or use Memcached::getStats() in a scheduled command to alert on downtime.
  • Prefix collisions: The default sess_ prefix is common. Always override it in shared environments. Keys are not namespaced by Laravel automatically beyond this prefix.
  • Expiration mismatch: SESSION_EXPIRE must be less than or equal to the memcached server’s -I (max item size) and -m (memory) limits. If sessions expire too early, check both the package config and Laravel’s session.lifetime.
  • Config caching: After changing .env values, run php artisan config:clear (or config:cache in production). The package reads config at boot, so stale caches cause confusing behaviour.
  • Debugging: Enable memcached logging (php -d memcached.debug=1) or use telnet to verify keys. The package does not provide a debug mode, so inspect raw memcached contents.
  • Extension point: The package likely binds a Memcached instance in the container. You can override it via a service provider to set custom options (e.g. Memcached::OPT_COMPRESSION, timeouts) without forking the package.
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.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings