levizoesch / laravel-zep-sdk
A simple SDK to consume Zep for Laravel.
1.0.2
2024-05-20 06:58 UTC
Requires
- php: ^8.0|^8.1|^8.2
- ext-curl: *
- illuminate/contracts: ^8.0|^9.0|^10.0
- levizoesch/laravel-clear-everything: ^1.0
- levizoesch/laravel-set-environment: ^1.0
- spatie/laravel-package-tools: ^1.0
Requires (Dev)
- brianium/paratest: ^1.0|^2.0|^3.0|^4.0|^5.0|^6.0|^7.0
- nunomaduro/collision: ^1.0|^2.0|^3.0|^4.0|^5.0|^6.0|^7.0
- orchestra/testbench: ^1.0|^2.0|^3.0|^4.0|^5.0|^6.0|^7.0|^8.0
- pestphp/pest: ^1.0|^2.0
- pestphp/pest-plugin-laravel: ^1.0|^2.0
- phpunit/phpunit: ^1.0|^2.0|^3.0|^4.0|^5.0|^6.0|^7.0|^8.0|^9.0|^10.0
- tymon/jwt-auth: ^2.0
README
This is an unofficial Zep SDK for Laravel.
This was written around https://help.getzep.com/api-reference and is not an official SDK.
Last Updated 05/2024
NOTE: This is a WIP, and not yet stable for production.
Installation
composer require levizoesch/laravel-zep-sdk
Publish configuration file.
php artisan vendor:publish --tag=zep-sdk-config
Set Zep Token
php artisan env:set ZEP_TOKEN ABC_123-TOKEN
Examples
User
Examples to handle user.
$zepClient = new ZepClient('YOUR_ZEP_TOKEN');
Create a Laravel Controller, and begin your crud actions.
// Create a new user
$newUser = $zepClient->createNewUser([
'email' => 'fake@email.com',
'first_name' => 'Levi',
'last_name' => 'Zoesch',
'metadata' => null,
'user_id' => Str::uuid()
]);
//dd('create',$result);
// Find the user by ID.
$findResult = $zepClient->getByUserId($newUser->user_id);
//dd('find',$find);
// Update the user.
$updateResult = $zepClient->updateByUserId($findResult->user_id, [
'first_name' => 'LEVI',
'last_name' => 'UPDATED',
'metadata' => null,
'user_id' => $findResult->user_id
]);
//dd('updated',$updateResult);
$listUserSessions = $zepClient->getSessionsByUserId($updateResult->user_id);
//dd('User Sessions:', $listUserSessions);
// Destroy the user now, since weve stepped through everything.
$destroyedResult = $zepClient->destroyByUserId($findResult->user_id);
dd('Destroyed User:', $destroyedResult);