Since this function is not native to PHP or Xdebug, it will not work. As mentioned above in the question’s comments, this is a Cakephp function, but it is possible to add it to your project.
For this just follow the step by step below.
Adding function to your project
Download the file https://pastebin.com/Eff17ysa and add into the folder Cake/Error with the name Debugger.php.
Download the file https://pastebin.com/jDQWA7Cs and add into the folder Cake/Log with the name Log.php.
Download the file https://pastebin.com/ZZHnh5Le and add into the folder Cake/Utility with the name Hash.php.
Download the file https://pastebin.com/mueEu8fq and add into the folder Cake/Utility with the name Text.php.
Download the file https://pastebin.com/VMHFMH6A and add into the folder Cake with the name Basics.php
Download the css file https://pastebin.com/3i1sSMXz and add to your project (Optional).
Using the function debug
in your project
To use in your project, just follow the code below:
<?php
spl_autoload_register(function($classname) {
$file = sprintf("%s.php", $classname);
if (file_exists($file)) {
require_once $file;
} else {
throw new RuntimeException("File {$file} not found", 404);
}
});
require_once "cake/basics.php";
$json = '[
{
"_id": "5a4e7fe189a2b22149d1c7ec",
"index": 0,
"guid": "a56c5543-ee29-4cf8-94df-f320eb431f55",
"isActive": false,
"balance": "$2,254.23",
"picture": "http://placehold.it/32x32",
"age": 24,
"eyeColor": "green",
"name": "Rose Stewart",
"gender": "female",
"company": "COMTOUR",
"email": "[email protected]",
"phone": "+1 (987) 485-2948",
"address": "107 Schenectady Avenue, Klagetoh, Arkansas, 204",
"about": "Ipsum sit labore in pariatur sit reprehenderit ut incididunt elit minim amet. Et occaecat est velit deserunt. Nostrud ad laboris adipisicing officia deserunt non sunt tempor qui. Labore anim in eiusmod voluptate nisi nostrud commodo amet cupidatat consectetur nostrud nulla. Culpa nisi Lorem voluptate commodo nisi. Commodo fugiat commodo tempor eiusmod excepteur. Tempor duis eiusmod pariatur reprehenderit.\r\n",
"registered": "2014-07-02T10:14:10 +03:00",
"latitude": 25.711449,
"longitude": 149.030368,
"tags": [
"cupidatat",
"aute",
"incididunt",
"Lorem",
"sunt",
"in",
"ipsum"
],
"friends": [
{
"id": 0,
"name": "Traci Duran"
},
{
"id": 1,
"name": "Tanisha Burris"
},
{
"id": 2,
"name": "Sherry Kirk"
}
],
"greeting": "Hello, Rose Stewart! You have 9 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "5a4e7fe18afe28b610c8907d",
"index": 1,
"guid": "47d8f51f-74b4-4c65-a5be-78b368da58bf",
"isActive": false,
"balance": "$2,457.97",
"picture": "http://placehold.it/32x32",
"age": 28,
"eyeColor": "green",
"name": "Phoebe Bridges",
"gender": "female",
"company": "TELLIFLY",
"email": "[email protected]",
"phone": "+1 (941) 475-3973",
"address": "374 Centre Street, Aberdeen, District Of Columbia, 1342",
"about": "Esse consectetur anim nulla ut incididunt exercitation. Fugiat officia ad id elit sunt deserunt exercitation ullamco esse eiusmod elit commodo. Irure in exercitation occaecat irure dolor exercitation. Irure anim in labore ea cupidatat fugiat. Officia tempor elit eiusmod officia labore nostrud cillum ea. Officia reprehenderit elit Lorem Lorem nulla ullamco irure. Nulla esse officia magna cupidatat labore occaecat in labore.\r\n",
"registered": "2015-10-07T08:16:50 +03:00",
"latitude": 80.841288,
"longitude": 102.12139,
"tags": [
"excepteur",
"ut",
"fugiat",
"officia",
"tempor",
"ad",
"deserunt"
],
"friends": [
{
"id": 0,
"name": "Stanton Chen"
},
{
"id": 1,
"name": "Grimes Potts"
},
{
"id": 2,
"name": "Wilder Pope"
}
],
"greeting": "Hello, Phoebe Bridges! You have 1 unread messages.",
"favoriteFruit": "apple"
},
{
"_id": "5a4e7fe1fdf182534ff057a7",
"index": 2,
"guid": "abab8774-a1bd-42f1-ba4f-5c3b19c4eb89",
"isActive": true,
"balance": "$2,843.88",
"picture": "http://placehold.it/32x32",
"age": 37,
"eyeColor": "green",
"name": "Reese Jackson",
"gender": "male",
"company": "LIQUIDOC",
"email": "[email protected]",
"phone": "+1 (956) 593-2808",
"address": "852 Irvington Place, Walland, Mississippi, 7598",
"about": "Aute quis eu consequat aliqua Lorem id magna ex anim enim esse qui id. In cupidatat voluptate ut Lorem. Laboris ipsum laborum qui in veniam est et fugiat et minim labore.\r\n",
"registered": "2016-10-11T01:34:32 +03:00",
"latitude": 28.71233,
"longitude": 76.544442,
"tags": [
"sint",
"id",
"velit",
"sunt",
"fugiat",
"nostrud",
"enim"
],
"friends": [
{
"id": 0,
"name": "Johnston Levy"
},
{
"id": 1,
"name": "Tisha Bean"
},
{
"id": 2,
"name": "Roseann Allen"
}
],
"greeting": "Hello, Reese Jackson! You have 8 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "5a4e7fe10d545530d9b4290d",
"index": 3,
"guid": "80449941-15ce-4734-aee7-42439408d7e7",
"isActive": true,
"balance": "$1,746.87",
"picture": "http://placehold.it/32x32",
"age": 25,
"eyeColor": "brown",
"name": "Gallegos Short",
"gender": "male",
"company": "PARAGONIA",
"email": "[email protected]",
"phone": "+1 (805) 521-2988",
"address": "462 Hart Place, Lawrence, Alabama, 9109",
"about": "Dolor occaecat ea do incididunt. Eu sit sit exercitation et quis. Minim officia proident enim enim anim nostrud est eu excepteur veniam in eu culpa. Non sit aute minim nostrud voluptate consectetur deserunt eiusmod enim incididunt id. Commodo aliquip tempor ut ad. Laborum consequat sit ullamco adipisicing consequat occaecat sunt Lorem tempor exercitation nulla deserunt minim. Nulla id elit ea pariatur aliquip elit.\r\n",
"registered": "2017-05-11T03:32:22 +03:00",
"latitude": -22.592765,
"longitude": -118.326613,
"tags": [
"nulla",
"minim",
"eu",
"sunt",
"ut",
"incididunt",
"dolor"
],
"friends": [
{
"id": 0,
"name": "Lea Arnold"
},
{
"id": 1,
"name": "Marla Acosta"
},
{
"id": 2,
"name": "Bailey Clay"
}
],
"greeting": "Hello, Gallegos Short! You have 8 unread messages.",
"favoriteFruit": "strawberry"
},
{
"_id": "5a4e7fe169ab13c7ca60517d",
"index": 4,
"guid": "fb83500c-4fa0-4146-8bdf-3363b66cdd9a",
"isActive": false,
"balance": "$3,613.46",
"picture": "http://placehold.it/32x32",
"age": 39,
"eyeColor": "blue",
"name": "Rivers Ayers",
"gender": "male",
"company": "QUANTASIS",
"email": "[email protected]",
"phone": "+1 (958) 479-3701",
"address": "384 Albee Square, Noxen, Texas, 5220",
"about": "Magna id ea in sint. Veniam esse duis ipsum commodo dolor laboris ea ut irure ea. Sunt culpa deserunt labore dolore eu ad esse amet quis excepteur deserunt laborum elit. Elit eiusmod veniam pariatur aute duis sint id et velit proident tempor commodo ut sint.\r\n",
"registered": "2015-09-08T09:24:58 +03:00",
"latitude": -79.499936,
"longitude": 19.478766,
"tags": [
"sint",
"mollit",
"dolor",
"tempor",
"adipisicing",
"exercitation",
"quis"
],
"friends": [
{
"id": 0,
"name": "Brandie Stevens"
},
{
"id": 1,
"name": "Matilda Barber"
},
{
"id": 2,
"name": "Pat Le"
}
],
"greeting": "Hello, Rivers Ayers! You have 3 unread messages.",
"favoriteFruit": "banana"
},
{
"_id": "5a4e7fe191c95b83d579b6c7",
"index": 5,
"guid": "2695c3ef-c4ec-4bd8-90b6-cd9384dd615a",
"isActive": true,
"balance": "$1,350.94",
"picture": "http://placehold.it/32x32",
"age": 29,
"eyeColor": "brown",
"name": "Olga England",
"gender": "female",
"company": "GENMEX",
"email": "[email protected]",
"phone": "+1 (824) 416-2274",
"address": "993 Garnet Street, Calpine, Virgin Islands, 8308",
"about": "Velit ipsum labore veniam voluptate quis duis in laboris irure nisi deserunt magna. Anim irure quis aute pariatur. Magna proident do reprehenderit commodo duis sit. Est reprehenderit dolor commodo nostrud commodo minim tempor aute irure elit. Esse nisi excepteur ex excepteur sunt enim sint et duis velit proident. Do nisi nisi duis ipsum consequat nulla ipsum voluptate.\r\n",
"registered": "2015-08-30T09:19:52 +03:00",
"latitude": 21.195056,
"longitude": -148.916229,
"tags": [
"ad",
"id",
"cillum",
"nisi",
"fugiat",
"consectetur",
"magna"
],
"friends": [
{
"id": 0,
"name": "Herminia Parker"
},
{
"id": 1,
"name": "Louisa Bennett"
},
{
"id": 2,
"name": "Cross Hatfield"
}
],
"greeting": "Hello, Olga England! You have 8 unread messages.",
"favoriteFruit": "banana"
}
]';
debug( json_decode($json) );
Has the documentation link that function?
– rray
Of
Xdebug
has that https://xdebug.org/docs/– Marcos Henzel
But I’ve used in other projects only the function
debug($variavel);
and it worked, just activate the debug in thephp.ini
if I’m not mistaken.– Marcos Henzel
One way I know it works is to put it at the beginning of the code, like: ini_set('display_errors', 1); ini_set('display_startup_errors', 1); error_reporting(E_ALL); .
– Marcos Henzel
I don’t know if this is the function of Xdebug, I’m trying to find in website list
– rray
Probably not a function of
xdebug
. Maybe it was a function of a framework, cms, etc.– Valdeir Psr
I used Cakephp, does this function is specific to it ?
– Marcos Henzel
So that’s it. The
debug()
is a function ofCakePHP
. The function is described below: https://book.cakephp.org/3.0/pt/development/debugging.html– Valdeir Psr
To add this function to your code, just copy this snippet https://github.com/cakephp/cakephp/blob/master/src/basics.php#L29-L63 and include this class in your code https://github.com/cakephp/cakephp/blob/master/src/Error/Debugger.php.
É necessário fazer pequenas modificações
– Valdeir Psr
I’ll try here Valdeir, but if you want, already put as an answer that I mark as correct, thanks for the help.
– Marcos Henzel