### Install and Configure Laravel Reverb Source: https://chatify.munafio.com/custom-websocket-server Install the Laravel Reverb package and run the installation command. Then, set the necessary environment variables in your .env file. ```bash composer require laravel/reverb php artisan reverb:install ``` -------------------------------- ### Run Chatify Installation Command Source: https://chatify.munafio.com/installation Execute this Artisan command after installing via Composer to automatically configure Chatify, publish assets, and create a storage symlink. ```bash $ php artisan chatify:install ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://chatify.munafio.com/upgrading-chatify To get additional information not directly on the page, perform an HTTP GET request with the 'ask' query parameter. The question should be specific and self-contained. ```http GET https://chatify.munafio.com/upgrading-chatify.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://chatify.munafio.com/notes Perform an HTTP GET request to the current page URL with the `ask` query parameter to dynamically query the documentation. Use this when the answer is not explicitly present, for clarification, or to retrieve related sections. ```http GET https://chatify.munafio.com/notes.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://chatify.munafio.com/custom-websocket-server Perform an HTTP GET request to the current page URL with the `ask` query parameter to dynamically query the documentation. The question should be specific and in natural language. ```http GET https://chatify.munafio.com/custom-websocket-server.md?ask= ``` -------------------------------- ### Query Documentation via HTTP GET Source: https://chatify.munafio.com/apis Perform an HTTP GET request to query the documentation dynamically. Use the 'ask' query parameter with a specific, self-contained question in natural language. The response will include a direct answer and relevant excerpts. ```http GET https://chatify.munafio.com/apis.md?ask= ``` -------------------------------- ### Query Documentation with 'ask' Parameter Source: https://chatify.munafio.com/customizations To get specific information not directly on the page, make a GET request to the page URL with the `ask` query parameter followed by your question. ```http GET https://chatify.munafio.com/customizations.md?ask= ``` -------------------------------- ### Install Chatify Package with Composer Source: https://chatify.munafio.com/installation Use Composer to add the Chatify package to your Laravel project. Ensure you have Laravel's default authentication system installed if it's a new project. ```bash $ composer require munafio/chatify ``` -------------------------------- ### Configure .env for beyondcode/laravel-websockets Source: https://chatify.munafio.com/custom-websocket-server Set these environment variables in your .env file to connect to a beyondcode/laravel-websockets server. Ensure the ports and schemes match your server setup. ```sh PUSHER_APP_ID=pusher_app_id # Any random string PUSHER_APP_KEY=pusher_app_key # Any random string PUSHER_APP_SECRET=pusher_app_secret # Any random string PUSHER_HOST=127.0.0.1 # Server host PUSHER_PORT=6001 # Server port PUSHER_SCHEME=http # For SSL use `https`, otherwise use `http`. PUSHER_APP_CLUSTER=mt1 LARAVEL_WEBSOCKETS_PORT="${PUSHER_PORT}" # Laravel WS port LARAVEL_WEBSOCKETS_SSL_LOCAL_PK=private_key_path # Optional for using SSL. LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT=certificate_path # Optional for using SSL. ``` -------------------------------- ### Publish Chatify Controllers Source: https://chatify.munafio.com/customizations Publish the controllers asset to allow for modifications. This is one of the assets not published during the initial installation. ```bash php artisan vendor:publish --tag=chatify-controllers ``` -------------------------------- ### Migrate Database for Chatify Source: https://chatify.munafio.com/installation Run this Artisan command to create the necessary database tables for Chatify. ```bash $ php artisan migrate ``` -------------------------------- ### Configure Attachment Settings Source: https://chatify.munafio.com/configurations Set up attachment configurations including storage folder, download route, allowed image/file types, and maximum upload size in MB. ```php 'attachments' => [ 'folder' => 'attachments', 'download_route_name' => 'attachments.download', 'allowed_images' => (array) ['png','jpg','jpeg','gif'], 'allowed_files' => (array) ['zip','rar','txt'], 'max_upload_size' => 150, // MB ], ``` -------------------------------- ### Configure Pusher Settings Source: https://chatify.munafio.com/configurations Set up Pusher integration including debug mode, app credentials, and connection options like cluster and encryption. ```php 'pusher' => [ 'debug' => env('APP_DEBUG', false), 'key' => env('PUSHER_APP_KEY'), 'secret' => env('PUSHER_APP_SECRET'), 'app_id' => env('PUSHER_APP_ID'), 'options' => (array) [ 'cluster' => env('PUSHER_APP_CLUSTER'), 'encrypted' => env('PUSHER_APP_USETLS'), ], ], ``` -------------------------------- ### Publish Chatify Assets Source: https://chatify.munafio.com/upgrading-chatify Run this command after upgrading Chatify to re-publish its assets. This ensures assets are up-to-date and prevents issues. ```bash php artisan chatify:publish ``` -------------------------------- ### Configure Chatify Routes Source: https://chatify.munafio.com/configurations Set the prefix, middleware, and namespace for Chatify's web routes. The default prefix is 'chatify'. ```php 'routes' => [ 'prefix' => env('CHATIFY_ROUTES_PREFIX', 'chatify'), 'middleware' => env('CHATIFY_ROUTES_MIDDLEWARE', ['web','auth']), 'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'Chatify\Http\Controllers'), ], ``` -------------------------------- ### Publish Chatify Assets Source: https://chatify.munafio.com/customizations Use this command to publish specific assets of the Chatify package. Replace `` with the desired asset, such as `config`, `views`, `assets`, `models`, `migrations`, or `controllers`. ```bash php artisan vendor:publish --tag=chatify- ``` -------------------------------- ### Configure Chatify API Routes Source: https://chatify.munafio.com/configurations Define custom API routes, prefix, middleware, and namespace for Chatify's API endpoints. Defaults to 'chatify' prefix and 'api' middleware. ```php 'api_routes' => [ 'custom' => env('CHATIFY_CUSTOM_ROUTES', false), 'prefix' => env('CHATIFY_API_ROUTES_PREFIX', 'chatify'), 'middleware' => env('CHATIFY_API_ROUTES_MIDDLEWARE', ['api']), 'namespace' => env('CHATIFY_API_ROUTES_NAMESPACE', 'Chatify\Http\Controllers\Api'), ], ``` -------------------------------- ### Enable Custom Routes in config/chatify.php Source: https://chatify.munafio.com/customizations Set the `custom` routes configuration to `true` in `config/chatify.php` to enable custom route definitions for the Chatify package. ```php // config/chatify.php **... **/* |------------------------------------- | Routes configurations |------------------------------------- */ 'routes' => [ 'custom' => env('CHATIFY_CUSTOM_ROUTES', false), // set to true ... ], ... ``` -------------------------------- ### Configure Default Storage Disk Source: https://chatify.munafio.com/configurations Specify the storage disk for uploaded files and images. Defaults to 'public'. ```php 'storage_disk_name' => env('CHATIFY_STORAGE_DISK', 'public'), ``` -------------------------------- ### Configure User Avatar Settings Source: https://chatify.munafio.com/configurations Define the folder for storing user avatars and the default avatar image name. Defaults to 'users-avatar' folder and 'avatar.png'. ```php 'user_avatar' => [ 'folder' => 'users-avatar', 'default' => 'avatar.png', ], ``` -------------------------------- ### Publish Chatify Routes Source: https://chatify.munafio.com/customizations Publish the routes asset to enable modifications to the package's routing configuration. ```bash php artisan vendor:publish --tag=chatify-routes ``` -------------------------------- ### Enable Client Events in laravel-websockets config Source: https://chatify.munafio.com/custom-websocket-server Modify the 'config/websockets.php' file to enable client messages, which is crucial for proper integration with Chatify. ```php ... 'apps' => [ [ ... 'enable_client_messages' => true, # Set to `true` ... ], ], ... ``` -------------------------------- ### Automate Chatify Asset Publishing Source: https://chatify.munafio.com/upgrading-chatify Add the `chatify:publish` command to the `post-update-cmd` in your `composer.json` to automatically publish assets on updates. This helps maintain up-to-date assets and avoid future issues. ```json { "scripts": { "post-update-cmd": [ "@php artisan chatify:publish --ansi" ] } } ``` -------------------------------- ### Configure Notification Sounds Source: https://chatify.munafio.com/configurations Enable or disable notification sounds, specify the public path for sound files, and set the filename for new message alerts. ```php 'sounds' => [ 'enabled' => true, 'public_path' => 'sounds/chatify', 'new_message' => 'new-message-sound.mp3', ] ``` -------------------------------- ### Enable Gravatar Support Source: https://chatify.munafio.com/configurations Configure Gravatar integration for user avatars. Set 'enabled' to true to use Gravatar. Options include image size and imageset. ```php 'gravatar' => [ 'enabled' => true, 'image_size' => 200, 'imageset' => 'identicon' ], ``` -------------------------------- ### Map Pusher Variables to Reverb Variables Source: https://chatify.munafio.com/custom-websocket-server Update your .env file to use the Reverb environment variables for the Pusher settings. This redirects Chatify's WebSocket communication to Reverb. ```dotenv PUSHER_APP_ID = "${REVERB_APP_ID}" PUSHER_APP_KEY = "${REVERB_APP_KEY}" PUSHER_APP_SECRET = "${REVERB_APP_SECRET}" PUSHER_HOST = "${REVERB_HOST}" PUSHER_PORT = "${REVERB_PORT}" PUSHER_SCHEME = "${REVERB_SCHEME}" PUSHER_APP_CLUSTER = "mt1" (default: mt1) BROADCAST_DRIVER = reverb ``` -------------------------------- ### Configure SSL for Laravel Reverb Server Source: https://chatify.munafio.com/custom-websocket-server Update the 'servers' configuration in 'config/reverb.php' and set the SSL certificate and private key paths in your .env file to enable SSL for Reverb. ```php 'servers' => [ 'reverb' => [ 'host' => env('REVERB_SERVER_HOST', '0.0.0.0'), 'port' => env('REVERB_SERVER_PORT', 8080), 'hostname' => env('REVERB_HOST'), 'options' => [ 'tls' => [ 'verify_peer' => false, 'local_cert' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT', null), 'local_pk' => env('LARAVEL_WEBSOCKETS_SSL_LOCAL_PK', null), ], ], 'max_request_size' => env('REVERB_MAX_REQUEST_SIZE', 10_000), 'scaling' => [ 'enabled' => env('REVERB_SCALING_ENABLED', false), 'channel' => env('REVERB_SCALING_CHANNEL', 'reverb'), 'server' => [ 'url' => env('REDIS_URL'), 'host' => env('REDIS_HOST', '127.0.0.1'), 'port' => env('REDIS_PORT', '6379'), 'username' => env('REDIS_USERNAME'), 'password' => env('REDIS_PASSWORD'), 'database' => env('REDIS_DB', '0'), ], ], 'pulse_ingest_interval' => env('REVERB_PULSE_INGEST_INTERVAL', 15), 'telescope_ingest_interval' => env('REVERB_TELESCOPE_INGEST_INTERVAL', 15), ], ], ``` ```bash LARAVEL_WEBSOCKETS_SSL_LOCAL_CERT = LARAVEL_WEBSOCKETS_SSL_LOCAL_PK = ``` -------------------------------- ### Use Custom Chatify Class in MessagesController Source: https://chatify.munafio.com/customizations Replace the default Chatify facade import with your custom class import in `MessagesController.php` to utilize your overridden methods. ```php // MessagesController.php Chatify\Facades\ChatifyMessenger::class, ``` -------------------------------- ### Set Chatify Display Name Source: https://chatify.munafio.com/configurations Configure the name displayed for the messenger in the UI. Defaults to 'Chatify Messenger'. ```php 'name' => env('CHATIFY_NAME', 'Chatify Messenger'), ``` -------------------------------- ### Define Messenger Colors Source: https://chatify.munafio.com/configurations An array of hexadecimal color codes that users can select from for the messenger's appearance. ```php 'colors' => (array) [ '#2180f3', '#2196F3', '#00BCD4', '#3F51B5', '#673AB7', '#4CAF50', '#FFC107', '#FF9800', '#ff2522', '#9C27B0', ], ``` -------------------------------- ### Update Controller Namespace in config/chatify.php Source: https://chatify.munafio.com/customizations Modify the `namespace` for web routes in `config/chatify.php` to point to your custom controller location. This is required after publishing the controllers asset. ```php ... 'namespace' => env('CHATIFY_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify'), ... ``` -------------------------------- ### Update API Controller Namespace in config/chatify.php Source: https://chatify.munafio.com/customizations Modify the `namespace` for API routes in `config/chatify.php` to point to your custom API controller location. This is required after publishing the controllers asset. ```php ... 'namespace' => env('CHATIFY_API_ROUTES_NAMESPACE', 'App\Http\Controllers\vendor\Chatify\Api'). ... ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.