1. Go to this page and download the library: Download mconsult/anfi-debug 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/ */
mconsult / anfi-debug example snippets
// Cache variables
$key = _debug([
'variable1' => $value1,
'variable2' => $value2,
// Add as many variables as needed
]);
$key = _debug($variables, 'my-custom-key');
$success = _forget($key);
if ($success) {
echo "Cache key '{$key}' has been removed.";
} else {
echo "Cache key '{$key}' does not exist.";
}
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ExampleController extends Controller
{
public function index()
{
$data = [
'user' => auth()->user(),
'settings' => config('app.settings'),
];
// Cache variables for debugging
$key = _debug($data);
// Now, visit http://your-app-url/debug/{$key} to view the variables
return view('welcome');
}
public function clearDebug()
{
$key = 'debug-614c1b5e5f8b2'; // Replace with your actual key
$success = _forget($key);
if ($success) {
return redirect()->back()->with('status', "Debug cache '{$key}' has been cleared.");
} else {
return redirect()->back()->with('status', "Debug cache '{$key}' does not exist.");
}
}
}