PHP code example of webgrafia / cheshire-cat-sdk-laravel
1. Go to this page and download the library: Download webgrafia/cheshire-cat-sdk-laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
webgrafia / cheshire-cat-sdk-laravel example snippets
use CheshireCatSdk\Facades\CheshireCatFacade as CheshireCat;
$response = CheshireCat::status();
if ($response->getStatusCode() === 200) {
echo "API is up and running!";
}
use Illuminate\Support\Facades\Route;
use CheshireCatSdk\Facades\CheshireCatFacade as CheshireCat;
Route::get('/meow_connection', function () {
try {
// Try to get the status of the Cheshire Cat API
$statusResponse = CheshireCat::getStatus();
// Check if the status response is successful
if ($statusResponse->getStatusCode() === 200) {
echo "Cheshire Cat API connection successful!<br>";
echo "Status Response: " . $statusResponse->getBody()->getContents();
} else {
echo "Cheshire Cat API connection failed!<br>";
echo "Status Response: " . $statusResponse->getBody()->getContents();
}
} catch (\Exception $e) {
echo "Cheshire Cat API connection failed!<br>";
echo "Error: " . $e->getMessage();
}
});