mlanin / laravel-api-debugger Goto Github PK
View Code? Open in Web Editor NEWEasy debug for your JSON API.
Home Page: http://blog.lanin.me/easy-debug-for-your-json-api/
License: MIT License
Easy debug for your JSON API.
Home Page: http://blog.lanin.me/easy-debug-for-your-json-api/
License: MIT License
Tried to use this, but no idea how. How to attach log to JSON response?
Thanks for making this debugger tool.
I want to display the 'model' (query running from particular model) parameter name like this:
"debug": {
"database": {
"total": 5,
"items": [
{
"model": "App\User",
"connection": "mysql",
"query": "select * from `ta_users`;",
"time": 106.27
},
]
}
}
Please help me with this additional parameter.
Thanks
This is somewhat related to #4, but not quite.
I think this issue is caused by:
https://wiki.php.net/rfc/tostring_exceptions
Additionally convert the “could not be converted to string” and “__toString() must return a string value” recoverable fatal errors into proper Error exceptions, in line with the error policy established in PHP 7.
Like in topic, queries didn't show using jenssegers/mongodb
FatalErrorException in QueriesCollection.php line 73:
Object of class DateTime could not be converted to string
this happens when using Laravel's Passport to generate tokens. The tokens are inserted into db as DateTime and it seems there are problems when doing
$query = vsprintf(str_replace(['%', '?'], ['%%', "'%s'"], $query), $attributes) . ';';
you can see in the attached screenshot that $atributes[5] and $atributes[6] are of type DateTime..
Hi,
It's or will be possible see total time of all queries?
Right now is possible see time for each query, but not for all queries.
Thank you very much.
from google translate
Would be very cool and useful if this at least had an option to sort by the execution time, I use your package to frequently debug long queries
Tries to convert binary UUID from models to JSON and fails
Malformed UTF-8 characters, possibly incorrectly encoded
Hi, im on Laravel Framework 6.17.1 run into this :
Symfony\Component\Debug\Exception\FatalThrowableError : Argument 1 passed to Lanin\Laravel\ApiDebugger\ServiceProvider::registerCollections() must be of the type array, null given, called in E:\laragon-x86\www\w4c\vendor\lanin\laravel-api-debugger\src\ServiceProvider.php on line 26
any clue why this happen?
one can temporary fix by copy paste array from config to this ServiceProvider.php :
public function boot()
{
$configPath = __DIR__ . '/../config/api-debugger.php';
$this->publishes([$configPath => config_path('api-debugger.php')]);
$this->mergeConfigFrom($configPath, 'api-debugger');
// Register collections only for debug environment.
$config = $this->app['config'];
if ($config['app.debug']) {
$this->registerCollections([
// Database queries.
\Lanin\Laravel\ApiDebugger\Collections\QueriesCollection::class,
// Show cache events.
\Lanin\Laravel\ApiDebugger\Collections\CacheCollection::class,
// Profile custom events.
\Lanin\Laravel\ApiDebugger\Collections\ProfilingCollection::class,
]);
}
}
I have in my .env-File:
APP_DEBUG=false
API_DEBUGGER_ENABLED=false
But debug is not disabled.
First of all, great package, thanks !
I noticed a problem though.
if an error is caught like so:
catch ( QueryException $e) {
$mssg = "An account with these details already exists";
return response()->json(["error_list" => compact('mssg')]);
}
the sql key inside debug is blank.
any way to fix this ?
Is there any option to disable debugging dynamically, for example to enable for certain requests and disable for others? Something like:
Debugger::disable();
Debugger::enable();
Thank you
First, thanks for the work on this package.
Trying to return a simple response with "Unauthorized"
return response()->json("Unauthorized", 401)
The variable $data on src/Debugger.php line 117 will then be "Unauthorized".
This will cause a crash on line 123 on the same function when attempting to add the debugging details to the $data variable which is a string, not an object.
$data->{$this->responseKey} = $this->storage->getData();
This can be easily fixed if a check is added before the information is added to $data variable.
L.E.: I know there is an workaround to change response to:
return response()->json(["message" => "Unauthorized"], 401)
but would be nice if you could still return something without wrapping it and i would like to not return debug info when an user is not authenticated.
Maybe another idea would be to be able to disable logging on the fly, something like
Debugger::disable();
Version: 3.5.0.
Laravel version: 6.17.1
Please let me know if you need additional information.
I'm trying to implement your package but i have no result, i tried the facade way but no success
Call to undefined function Lanin\Laravel\ApiDebugger\config_path()
My api app use both mysql and mongo and i use https://github.com/jenssegers/laravel-mongodb for mongodb eloquent, i want to know that can i get mongo query in response or should i use other package?
it will crash if the response data is empty :-
the fix go to line 110
and replace:
$data = $response->getData(true);
by
$data = $response->getData(true) ?: [];
that should do it..
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.