### Install Laravel Crisp Package Source: https://github.com/ziming/laravel-crisp/blob/main/README.md Installs the Laravel Crisp package using Composer. This is the primary method for adding the library to your Laravel project. ```Bash composer require ziming/laravel-crisp ``` -------------------------------- ### User-Friendly Method Signatures in Laravel Crisp Source: https://github.com/ziming/laravel-crisp/blob/main/README.md Illustrates how the Laravel Crisp package modifies method signatures for improved user-friendliness compared to the official SDK. Examples include direct argument passing for conversation creation and Carbon instance support for scheduling reminders. ```php // Official SDK takes params array, this package takes direct arguments $laravelCrisp->websiteConversations->create('website name', 'website.domain'); // Official SDK requires ISO 8601 string for date, this package accepts Carbon instance $laravelCrisp->websiteConversations->scheduleReminder($sessionId, now()->addDay(), 'Note'); ``` -------------------------------- ### Basic Usage: Laravel Crisp vs. Official SDK Source: https://github.com/ziming/laravel-crisp/blob/main/README.md Demonstrates the instantiation and basic usage of both the official PHP Crisp SDK and the Laravel Crisp package, highlighting the convenience of not needing to repeatedly set credentials and website IDs with the latter. ```php use Crisp\CrispClient; $officialCrisp = new CrispClient(); $officialCrisp->setTier('plugin'); $officialCrisp->authenticate( config('crisp.access_key_id'), config('crisp.secret_access_key') ); $officialCrisp->websitePeople->findByEmail(config('crisp.website_id'), 'abc@example.com'); // This Package $laravelCrisp = new Ziming\LaravelCrisp(); $laravelCrisp->websitePeople->findByEmail('abc@example.com'); // Laravel facade approach \Ziming\LaravelCrisp\Facades\LaravelCrisp::websitePeople() ->findByEmail('abc@example.com'); // Using official client via the package $laravelCrisp->officialClient->websitePeople->findByEmail( config('crisp.website_id'), 'abc@example.com' ); ``` -------------------------------- ### Running Tests Source: https://github.com/ziming/laravel-crisp/blob/main/README.md Command to execute the test suite for the Laravel Crisp package. ```bash composer test ``` -------------------------------- ### Publish Laravel Crisp Configuration Source: https://github.com/ziming/laravel-crisp/blob/main/README.md Publishes the configuration file for the Laravel Crisp package. This allows you to customize settings like website ID and API keys. ```Bash php artisan vendor:publish --tag="crisp-config" ``` -------------------------------- ### Laravel Crisp Configuration File Source: https://github.com/ziming/laravel-crisp/blob/main/README.md The default configuration file for the Laravel Crisp package. It defines essential parameters for connecting to the Crisp Chat API, such as website ID and access keys. ```PHP return [ 'website_id' => env('CRISP_WEBSITE_ID'), 'tier' => env('CRISP_TIER', 'plugin'), 'access_key_id' => env('CRISP_ACCESS_KEY_ID'), 'secret_access_key' => env('CRISP_SECRET_ACCESS_KEY'), ]; ``` -------------------------------- ### Custom Methods in Laravel Crisp Package Source: https://github.com/ziming/laravel-crisp/blob/main/README.md Showcases additional methods provided by the Laravel Crisp package that are not present in the official SDK, such as generating profile and conversation links, retrieving people IDs by search text, fetching the last message, and obtaining DTO objects for conversations. ```php // Get Crisp Profile Link \Ziming\LaravelCrisp\Resources\WebsitePeople::getProfileLink('people-id'); // Get Crisp Conversation Link \Ziming\LaravelCrisp\Resources\WebsiteConversations::getConversationLink('session-id'); // Get first people ID by search text $laravelCrisp = new Ziming\LaravelCrisp(); $laravelCrisp->websitePeople->getFirstPeopleIdBySearchText('Some Phone Number as Crisp does not have an exact filter by phone feature yet (but coming soon)'); // Get last message of a conversation $laravelCrisp->websiteConversations->getOneLastMessage('session-id'); // Get a DTO object for a Crisp conversation $crispConversation = $laravelCrisp->websiteConversations->getOneCrispConversation('session-id'); // Accessing DTO properties $crispConversation->is_verified; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.