concrete5cojp/concrete5_debugbar

A package to integrate PHP Debug Bar with concrete5 CMS.

Installs: 56

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 6

Forks: 5

Open Issues: 1

Type:concrete5-package

0.3 2021-11-11 04:08 UTC

This package is auto-updated.

Last update: 2024-04-11 09:21:26 UTC


README

A package to integrate PHP Debug Bar with concrete5 CMS.

Installation

Install the debug bar to the site that managed using composer

If you are managing your concrete5 site using concrete5/composer, you can manage this package with composer too.

1. Modify your composer.json file

Add these packages to "require" section:

"concrete5cojp/concrete5_debugbar": "~0.2",
"slowprog/composer-copy-file": "~0.2"

Add these lines to "extra" section:

"copy-file": {
  "vendor/maximebf/debugbar/src/DebugBar/Resources/": "public/packages/concrete5_debugbar/vendor/maximebf/debugbar/src/DebugBar/Resources/"
}

Add "scripts" section:

"scripts": {
  "post-install-cmd": [
    "SlowProg\\CopyFile\\ScriptHandler::copy"
  ],
  "post-update-cmd": [
    "SlowProg\\CopyFile\\ScriptHandler::copy"
  ]
}

When you are managing your concrete5 site using composer, the vendor directory is outside from the document root. However, the debugbar package has some css/js/images in the vendor directory, so you have to move these static files. That's why we need to add the composer-copy-file package and the scripts section. You are also able to move Resources directory manually.

Entire composer.json example:

{
  "name": "concrete5/composer",
  "description": "A fully featured skeleton for a composer managed concrete5 site",
  "type": "project",
  "license": "MIT",
  "prefer-stable": true,
  "autoload": {
    "psr-4": {
      "ConcreteComposer\\" : "./src"
    }
  },
  "require": {
    "composer/installers": "^1.3",
    "concrete5/core": "^8.3",
    "vlucas/phpdotenv": "^2.4",
    "concrete5cojp/concrete5_debugbar": "dev-master",
    "slowprog/composer-copy-file": "~0.2"
  },
  "config": {
    "preferred-install": "dist"
  },
  "extra": {
    "branch-alias": {
      "dev-8.x": "8.x-dev"
    },
    "installer-paths": {
      "public/concrete": ["type:concrete5-core"],
      "public/application/themes/{$name}": ["type:concrete5-theme"],
      "public/packages/{$name}": ["type:concrete5-package"],
      "public/application/blocks/{$name}": ["type:concrete5-block"]
    },
    "copy-file": {
      "vendor/maximebf/debugbar/src/DebugBar/Resources/": "public/packages/concrete5_debugbar/vendor/maximebf/debugbar/src/DebugBar/Resources/"
    }
  },
  "scripts": {
    "post-install-cmd": [
      "SlowProg\\CopyFile\\ScriptHandler::copy"
    ],
    "post-update-cmd": [
      "SlowProg\\CopyFile\\ScriptHandler::copy"
    ]
  }
}

2. Download the package

$ composer update

3. Install the package

$ ./public/concrete/bin/concrete5 c5:package-install concrete5_debugbar

Install the debug bar to the site that managed without using composer

First, download package files

$ cd ./packages
$ git clone git@github.com:concrete5cojp/concrete5_debugbar.git
$ cd concrete5_debugbar

Then update composer.json as

{
    "name": "concrete5cojp/concrete5_debugbar",
    "description": "A package to integrate PHP Debug Bar with concrete5 CMS.",
    "type": "concrete5-package",
    "license": "MIT",
    "minimum-stability": "stable",
    "require": {
        "maximebf/debugbar": ">=1.0.0"
    },
    "replace": {
        "psr/log": "*",
        "symfony/polyfill-mbstring": "*"
    },
    "autoload": {
        "psr-4": {
            "Concrete5Debugbar\\": "src/Concrete5Debugbar/"
        }
    }
}

Finally you can install the package

$ composer install
$ cd ../../
$ ./concrete/bin/concrete5 c5:package-install concrete5_debugbar

Usage

Messages

You can add messages to this tab using compatible usage with PSR-3 logger.

\Core::make('debugbar/messages')->info('hello world');
\Core::make('debugbar/messages')->info($object);

Messages Tab

Timeline

Provides a way to log total execution time as well as taking "measures" (ie. measure the execution time of a particular operation).

\Core::make('debugbar/time')->startMeasure('longop', 'My long operation');
sleep(2);
\Core::make('debugbar/time')->stopMeasure('longop');

Timeline Tab

Request

You can check how concrete5 retreive request data in this tab.

Request Tab

Database

You can check all sql queries on current request in this tab.

Database Tab

Logs

You can check application logs (same as dashboard/reports/logs but you can quick access!).

Logs Tab

Environment

Get some information about the server environment.

Environment Tab