middlewares / debugbar Goto Github PK
View Code? Open in Web Editor NEWPSR-15 middleware to insert PHP DebugBar automatically in html responses
License: MIT License
PSR-15 middleware to insert PHP DebugBar automatically in html responses
License: MIT License
In my setup the webserver allows public access only to the folder where the front controller is located in (/var/www/html/public). When trying to use the debugbar it tries to embed JS and CSS files:
<link rel="stylesheet" type="text/css" href="/vendor/maximebf/debugbar/src/DebugBar/Resources/openhandler.css">
<script type="text/javascript" src="/vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/jquery/dist/jquery.min.js"></script>
The problem is that the vendor folder is not publicly accessible (for security reasons) and thus those CSS and JS files cannot be loaded. That is why I would appreciate a setting to embed JS and CSS code inline.
This is possible by using $renderer->dumpJSAssets() and $renderer->dumpCSSAssets().
Issue: The plugin expects that the vendor folder lives in http://<server>/vendor
, otherwise asset loading fails to some extend.
Debugbar->inline()
works to inline CSS and JS, but the fontawesome-font files are still requested from a wrong location.
It would be great if setting a base-URL for assets as in ->getJavascriptRenderer($baseUrl, $basePath)
would be possible.
How do I add this into a Slim3 app. It tried this $app->add(new Middlewares\Debugbar());
but got this error: Fatal error: Uncaught RuntimeException: {} is not resolvable in D:\checkinslim\vendor\slim\slim\Slim\CallableResolver.php on line 104
I am trying to get this working with Relay. I have not been able to make it work. Relay is a PSR-15 middleware dispatcher. I am also using zend-diactoros for my message factory interface. In theory, these should all work together.
I think my problem is I just don't know exactly what to pass to the Relay queue. I've tried a few things, including something like the following:
$queue[] = new Middlewares\Debugbar();
Can anyone offer any suggestions on how to get it to work? Thank you.
Even when set to inline the debug bar still tried to load the font awesome library. If your vendor folder is above the html root this creates 404 errors. The following are what it tries to load.
https://sample-domain.com/fonts/fontawesome-webfont.woff2?v=4.7.0
https://sample-domain.com/fonts/fontawesome-webfont.woff?v=4.7.0
https://sample-domain.com/fonts/fontawesome-webfont.ttf?v=4.7.0
https://sample-domain.com/fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular
Is there a way to pass messages through the debugbar with this middleware as documented here http://phpdebugbar.com/docs/base-collectors.html#messages ? I'm hoping that is already possible and I am just missing something.
You should note somewhere that the vendor directory must be accessible via HTTP.
If it's not accessible several 404 http errors appear and - of course - the debug bar will not work.
This information is neccessary because often (or should I say normally) the vendor is not accessible via HTTP.
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.