Skip to content

Assets are in vendor directory #2

Closed
@weierophinney

Description

@weierophinney

This is not really an issue of this repository, other than it will require a documentation point in the README.md file: the debugbar creates links and script references to files that are in the vendor/ directory. Examples:

  • /vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/font-awesome/css/font-awesome.min.css
  • /vendor/maximebf/debugbar/src/DebugBar/Resources/vendor/highlightjs/styles/github.css
  • /vendor/maximebf/debugbar/src/DebugBar/Resources/debugbar.css
  • etc.

The issue with this is that for many applications, the web root is not the same as the project root, which means that the vendor/ directory is not directly accessible via the web.

There are a few ways to fix the situation.

First, you can symlink the vendor/ directory into your web root:

$ cd public
$ ln -s ../vendor .

This is not recommended, as it exposes library code via the web.

A better way is to copy just the assets into a directory of your web root, and pass that relative path to the call to getJavascriptRenderer(). As an example:

$ cd public
$ cp -a ../vendor/maximebf/debugbar/src/DebugBar/Resources phpdebugbar

The above copies the entire set of assets into a directory named phpdebugbar/ in your web root. From there, you only need to alter the line where you retrieve the JSON renderer:

$debugbarRenderer = $debugbar->getJavascriptRenderer('phpdebugbar');

Once you've done that, everything works correctly.

I'd recommend adding this documentation to the README.md file to help users understand how to incorporate the middleware in such applications.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions