Giter Site home page Giter Site logo

phalcon2-debug-widget's Introduction

Phalcon Debug Widget (PDW) for Phalcon 2 (and 3)

  1. Forked from jymboche/phalcon-debug-widget

  2. Update from https://github.com/Zazza/phalcon-debug-widget

Changelog:

2 February 2018:

  • db panel output with htmlspecialchars

=====

1 February 2018:

  • The 'server' tab has been removed. Since this data can be viewed to any firebug from the browser
  • By default, css, js and html PDW code is minimized:
$ debugWidget = new \ PDW \ DebugWidget ($ di);

or

$ debugWidget = new \ PDW \ DebugWidget ($ di, [
         'db' => ['db'],
         'dispatch' => ['dispatcher'],
         'view' => ['view']
     ], $ minimify = false);

=====

  • it isn't necessary to move assets(/pdw-assets/) to public dir
  • jquery dependence is removed
  • the sections: Server, Views, Database hide and show by click

Note (How it works):

The debug widget for now is very simplistic and more of a proof-of-concept. It expects you have three services in your dependency injector named "db", "dispatcher" and "view" and that they correspond to those services. When you pass the DI to Phalcon Debug Widget It looks for those specific services and:

  • sets them as shared services
  • sets the eventManager for them
  • Attaches itself to those events

This means passing the DI to the debug widget will alter those services. Generally speaking, a shared db, dispatcher, and view is fine. If you have ideas for other ways to hook in, please open an issue for discussion.

The Phalcon Debug Widget is designed to make development easier by displaying debugging information directly in your browser window. Currently it displays php globals such as $_SESSION as well as outputing resource usage and database queries and connection information. It includes syntax highlighting via Prismjs.com.

If it looks familiar, its because its modeled after the Yii debug toolbar

Installation

composer.json:

"zazza/phalcon2-debug-widget": "dev-master"

Copy or move the /vendor/zazza/phalcon-debug-widget/src/pdw-assets folder to your public folder.

Usage and Configuration

Define a debug or environment flag in your main index.php file so you can easily disable the Phalcon Debug Widget on production environments. Example:

defined('PHALCONDEBUG') || define('PHALCONDEBUG', true);

After you have setup your \Phalcon\Loader and \Phalcon\DI\FactoryDefault() create a new instance of the debug widget.

if (PHALCONDEBUG == true) {
	$debugWidget = new \PDW\DebugWidget($di);
}

Preview

Attribution:

Bug Icon designed by Nithin Viswanathan from the Noun Project

phalcon2-debug-widget's People

Contributors

andrefigueira avatar at15 avatar jymboche avatar ogarbe avatar zazza avatar

Stargazers

 avatar

Watchers

 avatar

phalcon2-debug-widget's Issues

setDI wrong declaration

Fatal error: Declaration of PDW\DebugWidget::setDI() must be compatible with Phalcon\Di\InjectionAwareInterface::setDI(Phalcon\DiInterface $dependencyInjector) in /home/gatz/www/cms/app/vendor/zazza/phalcon-debug-widget/src/PDW/DebugWidget.php on line 11

Instead of
public function setDI($di)
put
public function setDI(\Phalcon\DiInterface $di)

Also, if the vendor directory is behind public folder, it won't display anything

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.